Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sections and wording based on #9 #10

Merged
merged 8 commits into from Sep 1, 2022
Merged

Conversation

frehner
Copy link
Owner

@frehner frehner commented Aug 31, 2022

@developit Thanks for the feedback/issue!

I'm a little unsure about how to address the point brought up for the Set the default module type for your JS files section, so any ideas there would be great!

Also, I'm not entirely sure if the way I phrased the Minify section is correct or good enough, so please feel free to put extra focus / requests for changes there.

Thanks again.

Closes #9

@@ -171,11 +190,10 @@ There are some good docs from the [NodeJS team](https://nodejs.org/api/packages.
"exports": {
".": {
"types": "index.d.ts",
"script": "index.umd.js",
"browser": "index.umd.js",
Copy link
Owner Author

@frehner frehner Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially a little hesitant about the browser field, due to some misunderstandings I had about how Vite currently handles it. However, I went through and re-read the latest PR again and realized I had misunderstood.

README.md Outdated

If a bundler or environment understands the `exports` field, then the `package.json`'s top-level [main](#set-the-main-field), [types](#set-the-types-field), [module](#set-the-module-field), and [browser](#set-the-browser-field) fields are ignored, as `exports` supersedes those fields. However, it's still importantant to set those fields, for tools or runtimes that do not yet understand the `exports` field.

If you have a "development" and a "production" bundle (for example, you have warnings in the development bundle that don't exist in the production bundle), then you can also set them in the `exports` field with `"development"` and `"production"`. `webpack` will recognize these conditions automatically, and Rollup [can be configured](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#exportconditions) to recognize them as well.
If you have a "development" and a "production" bundle (for example, you have warnings in the development bundle that don't exist in the production bundle), then you can also set them in the `exports` field with `"development"` and `"production"`. `webpack` and `vite` will recognize these conditions automatically; however, while Rollup [can be configured](https://github.com/rollup/plugins/tree/master/packages/node-resolve/#exportconditions) to recognize them, that is something that you would have to instruct developers to do in their own bundler config.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that vite also understands the prod/dev conditions. Yay!

@frehner frehner merged commit 9406724 into main Sep 1, 2022
@frehner frehner deleted the feedback-from-jason branch September 1, 2022 22:21
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
SyMind added a commit to SyMind/modern-guide-to-packaging-js-library that referenced this pull request Sep 2, 2022
frehner pushed a commit that referenced this pull request Sep 2, 2022
* translated into Chinese

* feat: name and version field

* translate dual package hazard

* fix: h type

* feat: exports

* translate the rest

* Update README-zh_CN.md

* translate files and type

* revise the translation

* fix anchor

* add zh_CN entry

* fix code style

* changes a bit of the content ( #10 )

* remove default field in example

Co-authored-by: zheng-chuang <zhengchuang_kindle@163.com>
Co-authored-by: 薛健超 <2289565671@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feedback
1 participant