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

docs(node-resolve): improve doc related to mainFields #138

Merged
merged 5 commits into from Jan 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 10 additions & 15 deletions packages/node-resolve/README.md
Expand Up @@ -47,40 +47,35 @@ Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#comma
### `mainFields`

Type: `Array[...String]`<br>
Default: `['module', 'main']`
Default: `['module', 'main']`<br>
Valid values: `['browser', 'jsnext', 'module', 'main']`

The fields to scan in a package.json to determine the entry point if this list contains "browser", overrides specified in "pkg.browser" will be used
Specifies the properties to scan within a `package.json`, used to determine the bundle entry point. The order of property names is significant, as the first-found property is used as the resolved entry point. If the array contains `'browser'`, key/values specified in the `package.json` `browser` property will be used.

### `module`

Type: `Boolean`<br>
Default: `true`

DEPRECATED: use "mainFields" instead
Use "module" field for ES6 module if possible

### `jsnext`
Use `pkg.module` field for ES6 module if possible. This option takes precedence over both "jsnext" and "main" in the list if such are present.
StreetStrider marked this conversation as resolved.
Show resolved Hide resolved

Type: `Boolean`<br>
Default: `false`
### `jsnext`

DEPRECATED: use "mainFields" instead
Use "jsnext:main" if possible, legacy field pointing to ES6 module in third-party libraries, deprecated in favor of "pkg.module", see: https://github.com/rollup/rollup/wiki/pkg.module

### `main`
Use `pkg['jsnext:main']` if possible, legacy field pointing to ES6 module in third-party libraries, deprecated in favor of `pkg.module`, see: https://github.com/rollup/rollup/wiki/pkg.module. This option takes precedence over "main" in the list if such is present.
StreetStrider marked this conversation as resolved.
Show resolved Hide resolved

Type: `Boolean`<br>
Default: `true`
### `main`

DEPRECATED: use "mainFields" instead
Use "main" field or index.js, even if it's not an ES6 module (needs to be converted from CommonJS to ES6) – see https://github.com/rollup/rollup-plugin-commonjs

Use `pkg.main` field or index.js, even if it's not an ES6 module (needs to be converted from CommonJS to ES6), see https://github.com/rollup/rollup-plugin-commonjs.
StreetStrider marked this conversation as resolved.
Show resolved Hide resolved

### `browser`

Type: `Boolean`<br>
Default: `false`

Some package.json files have a "browser" field which specifies alternative files to load for people bundling for the browser. If that's you, either use this option or add "browser" to the "mainFields" option, otherwise pkg.browser will be ignored
If `true`, instructs the plugin to use the `"browser"` property in `package.json` files to specify alternative files to load for bundling. This is useful when bundling for a browser environment. Alternatively, a value of `'browser'` can be added to the `mainFields` option. If `false`, any `"browser"` properties in package files will be ignored. This option takes precedence over `mainFields`.

### `extensions`

Expand Down