rollup / rollup-plugin-commonjs

This module has moved and is now available at @rollup/plugin-commonjs / https://github.com/rollup/plugins/blob/master/packages/commonjs
MIT License
501 stars 126 forks source link

Build halts prematurely with no error when module marked as external #380

Closed samthor closed 4 years ago

samthor commented 5 years ago

Repro here, in repro.js. Using Rollup 1.7.3 and 9.2.2 of this plugin.

Basically if we mark a (valid) module as external using Rollup like this:

  const bundle = await rollup.rollup({
    input: ['code/test.js'],
    plugins: [rollupPluginCommonJS()],
    external(id, importer, resolved) {
      return true;
    },
  });

... then the plugin stops running (similar to #341) so the process halts. (I'm going to try to understand what's going on, but filing a bug first.)

lukastaegert commented 5 years ago

Try to exclude modules starting with a \0 (these are internal to plugins), does this have an effect?

samthor commented 5 years ago

Yup, excluding those seems to be a workaround.

This generates a \0commonjs-proxy:... line but it seems easy (although potentially fragile) just to remove that.

So maybe there's two issues:

1) halting 2) should the \0commonjs-proxy:... import be removed (as per my rewriting) when the module is marked as external?

shellscape commented 4 years ago

Hey folks (this is a canned reply, but we mean it!). Thanks to everyone who participated in this issue. We're getting ready to move this plugin to a new home at https://github.com/rollup/plugins, and we have to do some spring cleaning of the issues to make that happen. We're going to close this one, but it doesn't mean that it's not still valid.

We've got some time yet before the move while we resolve pending Pull Requests, so if this issue is still relevant, please @ me and I'll make sure it gets reopened and transferred to the new repo. :beer: