-
Notifications
You must be signed in to change notification settings - Fork 40
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
Conversation
@@ -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", |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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!
* 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 <[email protected]> Co-authored-by: 薛健超 <[email protected]>
@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