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

2.1.0 treating ES6 modules as external dependencies #93

Closed
msroberts opened this issue Mar 31, 2017 · 11 comments · Fixed by #95
Closed

2.1.0 treating ES6 modules as external dependencies #93

msroberts opened this issue Mar 31, 2017 · 11 comments · Fixed by #95

Comments

@msroberts
Copy link

After updating to 2.1.0, rollup is not recognizing imported ES6 modules such as d3 or topojson. I tested this by following the process here: https://bl.ocks.org/mbostock/bb09af4c39c79cffcde4. With rollup-plugin-node-resolve set at version 2.0.0, it works as expected; however, with 2.1.0, it gives the message "Treating 'd3-selection' as external dependency" and does not include. d3-selection's package.json has a module field.

@Rich-Harris
Copy link
Contributor

Oh, that's odd — let me look into it. In the meantime, could you try adding module: true to the config, like so? Thanks

import node from "rollup-plugin-node-resolve";

export default {
  entry: "index.js",
  format: "umd",
  moduleName: "d3",
  plugins: [node({ module: true })],
  dest: "d3.js"
};

@msroberts
Copy link
Author

Still give the same error and does not include. Also tried with jsnext but no difference.

@Rich-Harris
Copy link
Contributor

I can't reproduce this — can you point me to a repo where this is failing please? Here's the gist where I tried to reproduce it — it finds d3-selection without any problems, with or without module: true.

@msroberts
Copy link
Author

I still get the error with the gist (but changed rollup version to 0.41 as npm could not find 0.46).

@Rich-Harris
Copy link
Contributor

Oops, typo — meant 0.41.6. Can you detail the exact steps you took to get that error? If I clone that repo, install dependencies, and run Rollup, it works as expected:

git clone https://gist.github.com/6b701db6d27eb783423ebd8098dec359.git
cd 6b701db6d27eb783423ebd8098dec359
npm i
npm run build
open index.html

@filipesilva
Copy link

filipesilva commented Mar 31, 2017

I'm getting this on Windows only. A repro can be found at /~https://github.com/filipesilva/node-resolve-windows-bug.

npm install
npm run rollup

On Windows the following message appears:

⚠️   'default' is imported from external module 'rollup' but never used

⚠️   '@angular/platform-browser-dynamic' is imported by src\main.js, but could not be resolved – treating it as an external dependency
/~https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency

⚠️   No name was provided for external module '@angular/platform-browser-dynamic' in options.globals – guessing '_angular_platformBrowserDynamic'

On Unix a bunch of The 'this' keyword is equivalent to 'undefined' appear instead, and the build is correctly generated.

Doing npm install rollup-plugin-node-resolve@2.0.0 makes the behavior be the same on both platforms.

@msroberts
Copy link
Author

I'm on Windows too. I get the same error in Command Prompt and Git Bash.

@Rich-Harris
Copy link
Contributor

Oohhh... I wonder if this was caused by #53

@Rich-Harris
Copy link
Contributor

This should be fixed in 2.1.1. Thanks

@msroberts
Copy link
Author

Works now. Thanks!

@bhousel
Copy link

bhousel commented Sep 27, 2017

For anyone who got here through googling and still has this issue, see #105 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants