danielgindi/rollup-plugin-natives

Skipping duplicate node modules

Closed this issue · 1 comments

The plguin seems to have problems determining bundling this:

  try {
    binding = require('./build/Release/superstring.node')
  } catch (e1) {
    try {
      binding = require('./build/Debug/superstring.node')
    } catch (e2) {
      throw e1
    }
  }

From https://github.com/atom/superstring/blob/master/index.js#L118-L125

I have only built the module for Release, but rollup-plugin-natives tries to copy both.

If we could have a replacement option that we would map the name of duplicate modules, and specify replacements for them, that will be awesome. Something like this:

      replacement: [
		{path:'node_modules/superstring/build/Debug/superstring.node': replacement:'superstring.node'}
      ],

Rollup commonjs plugin now supports try-catch scenarios, so this will solve the issue.
Regarding the copying of files, if you want to be able to disable copying of a specific .node file, you are welcome to open a PR :-)