calvinmetcalf / rollup-plugin-node-builtins

138 stars 40 forks source link

'default' is not exported by 'src/es6/http.js' #27

Closed rayrutjes closed 7 years ago

rayrutjes commented 7 years ago

We encounter the following issue:

'default' is not exported by 'node_modules/rollup-plugin-node-builtins/src/es6/http.js'

Here is the config file:

import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';

export default {
  entry: 'src/server/builds/node.js',
  plugins: [
    nodeResolve({
      // use "module" field for ES6 module if possible
      module: true, // Default: true

      // use "jsnext:main" if possible
      // – see https://github.com/rollup/rollup/wiki/jsnext:main
      jsnext: true,  // Default: false

      // use "main" field or index.js, even if it's not an ES6 module
      // (needs to be converted from CommonJS to ES6
      // – see https://github.com/rollup/rollup-plugin-commonjs
      main: true,  // Default: true

      // some package.json files have a `browser` field which
      // specifies alternative files to load for people bundling
      // for the browser. If that's you, use this option, otherwise
      // pkg.browser will be ignored
      browser: true,  // Default: false

      // whether to prefer built-in modules (e.g. `util`, `events`) or
      // local ones with the same names
      preferBuiltins: true  // Default: true
    }),
    commonjs(),
    globals(),
    builtins()
  ],
  targets: [
    { dest: 'dist/algoliasearch.server.esm.js', format: 'es' }
  ]
};

Any clue?

rayrutjes commented 7 years ago

Arg looks like putting commonjs last solves it. Would you like to explain why?

calvinmetcalf commented 7 years ago

maybe has to do with commonjs somethings thinking the use of the keyword global in an es6 module makes it a commonjs module?

rayrutjes commented 7 years ago

Not sure, anyway I did not have any issue since then, let me close this.