This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Description
This is a proposal in response to https://twitter.com/SavePointSam/status/975146310855622656
At the moment if someone wants to bundle everything but keep builtins as external dependencies, they have to do something like this:
import resolve from 'rollup-plugin-node-resolve';
export default ({
input: 'src/index.js',
plugins: [resolve()],
external: ['path', 'fs', ...],
output: {
file: 'build/server.js',
format: 'cjs'
}
})
i.e. they have to list all builtins manually in their externals list (and adapt this manually in the future). My feeling is that rollup-plugin-node-resolve already has the necessary dependencies to trivially implement an option externalBuiltins to do that for the user, i.e. the example could become
import resolve from 'rollup-plugin-node-resolve';
export default ({
input: 'src/index.js',
plugins: [resolve({externalBuiltins: true})],
output: {
file: 'build/server.js',
format: 'cjs'
}
})
Would like some feedback before preparing a PR (maybe this is already possible in some way?)
cc @keithamus, @guybedford