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

Apparently incorrect ECMAScript 2015 imports from acorn and resolve #236

Closed
haraldrudell opened this issue Oct 1, 2017 · 3 comments
Closed

Comments

@haraldrudell
Copy link

Confusion around default and named exports

If used with rollup, errors prevent successful build

Pull request coming up…

https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js (5:7)
3: import { sync } from 'resolve';
4: import { attachScopes, createFilter, makeLegalIdentifier } from 'rollup-pluginutils';
5: import acorn from 'acorn';
          ^
6: import { walk } from 'estree-walker';
7: import MagicString from 'magic-string';

[!] Error: 'default' is not exported by node_modules/acorn/dist/acorn.es.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js (5:7)
3: import { sync } from 'resolve';
4: import { attachScopes, createFilter, makeLegalIdentifier } from 'rollup-pluginutils';
5: import acorn from 'acorn';
          ^
6: import { walk } from 'estree-walker';
7: import MagicString from 'magic-string';
haraldrudell pushed a commit to haraldrudell/rollup-plugin-commonjs that referenced this issue Oct 1, 2017
@haraldrudell
Copy link
Author

Node.js v8.4.0
[email protected]
[email protected]

It is unclear to me in what environment those imports could ever have worked.
It seems acorn never had a default export
Because Rollup uses the plugin internally, Rollup may fail even if the rollup.config.js does not import the plugin

@Rich-Harris
Copy link
Contributor

Can you describe the situation in which this is failing in more detail? acorn is never bundled into this plugin, so it normally wouldn't matter whether you do import acorn or import { parse } (the first is just a hangover from older versions of acorn), because Rollup takes care of CommonJS interop. It probably should be import { parse }, but I'd like to understand the problem before changing anything, lest it cause issues for other people.

@haraldrudell
Copy link
Author

Comment is here: #237 (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

No branches or pull requests

3 participants