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

Fix import statements in examples in README.md #646

Merged
merged 2 commits into from Nov 28, 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
17 changes: 14 additions & 3 deletions packages/node-resolve/README.md
Expand Up @@ -166,7 +166,7 @@ Since most packages in your node_modules folder are probably legacy CommonJS rat

```js
// rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

export default {
Expand All @@ -176,7 +176,7 @@ export default {
format: 'iife',
name: 'MyModule',
},
plugins: [resolve(), commonjs()],
plugins: [nodeResolve(), commonjs()],
};
```

Expand All @@ -186,7 +186,18 @@ By default this plugin will prefer built-ins over local modules, marking them as

See [`preferBuiltins`](#preferbuiltins).

Use a plugin like [rollup-plugin-node-polyfills](https://github.com/ionic-team/rollup-plugin-node-polyfills) to provide stubbed versions of built-ins, and set `preferBuiltins` to `false`.
To provide stubbed versions of Node built-ins, yse a plugin like [rollup-plugin-node-polyfills](https://github.com/ionic-team/rollup-plugin-node-polyfills) or use [`builtin-modules`](https://github.com/sindresorhus/builtin-modules) with `external`, and set `preferBuiltins` to `false`. e.g.

```js
import { nodeResolve } from '@rollup/plugin-node-resolve';
import builtins from 'builtin-modules'
export default ({
input: ...,
plugins: [nodeResolve()],
external: builtins,
output: ...
})
```

## Resolving require statements

Expand Down