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

Add externalBuiltins option or make them external by default. #146

@lukastaegert

Description

@lukastaegert

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions