From 023dc4986901ca2c5623bac40765717a47075d1c Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Tue, 7 May 2019 15:16:14 +0100 Subject: [PATCH] docs: add note on builtins Fixes #146 --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 1e953dd..9bbbeb4 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,23 @@ export default { }; ``` +## Resolving Built-Ins (like `fs`) + +This plugin won't resolve any builtins (e.g. `fs`). If you need to resolve builtins you can install local modules and set `preferBuiltins` to `false`, or install a plugin like [rollup-plugin-node-builtins](https://github.com/calvinmetcalf/rollup-plugin-node-builtins) which provides stubbed versions of these methods. + +If you want to silence warnings about builtins, you can add the list of builtins to the `externals` option; like so: + +```js +import resolve from 'rollup-plugin-node-resolve'; +import builtins from 'builtin-modules' +export default ({ + input: ..., + plugins: [resolve()], + externals: builtins, + output: ... +}) +``` + ## License