calvinmetcalf / rollup-plugin-node-builtins

138 stars 40 forks source link

Clarification: order of builtins + globals plugins? #32

Closed binarykitchen closed 7 years ago

binarykitchen commented 7 years ago

What's the rule when to put the builtins plugin before the globals plugin? Or the other way around? I see many examples which have a different order of these plugins which is kinda confusing.

Would be good to have a clarification on that here, or even better in the readme. Thanks!

calvinmetcalf commented 7 years ago

Take a look at the config I published

binarykitchen commented 7 years ago

thanks - can you explain why this order? why globals before the built-ins?

and the 2nd question: what if more plugins are in play? for example those I have:

  plugins: [
    replace({'process.env.NODE_ENV': JSON.stringify('development')}),
    progress(),
    stylusCssModules({output: false}),
    alias({
      'readable-stream': 'stream'
    }),
    regenerator(),
    buble(),
    globals(),
    builtins(),
    nodeResolve({jsnext: true, browser: true}),
    commonjs(),
    json({preferConst: true}),
    filesize({showGzippedSize: false})
  ],

which produces this error:

bundling...
(602): package.json🚨   (buble plugin) Unexpected token (2:8)
undefined (2:8)

how would you investigate and proceed here? what's the recommendation how to fine-tune the order of rollup plugins?

calvinmetcalf commented 7 years ago

I have not used these things on anything as extensive and complex as you are trying to do, you are in uncharted territory so I'm sorry if I can't give you much more information

binarykitchen commented 7 years ago

thanks - i just hope there will be more examples in the uncharted territory soon ...