Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist/rollup.es.js imports default export from acorn that's not there #2628

Closed
tchetwin opened this issue Jan 3, 2019 · 1 comment · Fixed by #2636
Closed

dist/rollup.es.js imports default export from acorn that's not there #2628

tchetwin opened this issue Jan 3, 2019 · 1 comment · Fixed by #2636

Comments

@tchetwin
Copy link
Contributor

tchetwin commented Jan 3, 2019

  • Rollup Version: 1.0.1 (or 1.0.0)
  • Operating System (or Browser): Windows (git bash)
  • Node Version: 11.0.0

How Do We Reproduce?

Making a "minimal" #0CJS webpack@4 project that uses rollup@1.0.1 as a dependency, and trying to build it.

# Install goodies
npm install --save-dev rollup@1.0.1 webpack webpack-cli

# Set up a "main" that pulls rollup
mkdir src
echo "const rollup = require('rollup');" > src/index.js

# Invoke webpack
npx webpack-cli --target node

Expected Behavior

Webpack to succeed, without the following WARNINGs

Actual Behavior

Error output of the form:

WARNING in ./node_modules/rollup/dist/rollup.es.js 15988:0-14
"export 'default' (imported as 'acorn__default') was not found in 'acorn'
 @ ./src/index.js

WARNING in ./node_modules/rollup/dist/rollup.es.js 15993:20-34
"export 'default' (imported as 'acorn__default') was not found in 'acorn'
 @ ./src/index.js

WARNING in ./node_modules/rollup/dist/rollup.es.js 16018:28-42
"export 'default' (imported as 'acorn__default') was not found in 'acorn'
 @ ./src/index.js

WARNING in ./node_modules/rollup/dist/rollup.es.js 16030:28-42
"export 'default' (imported as 'acorn__default') was not found in 'acorn'
 @ ./src/index.js

WARNING in ./node_modules/rollup/dist/rollup.es.js 16048:11-25
"export 'default' (imported as 'acorn__default') was not found in 'acorn'
 @ ./src/index.js

Investigation

Following the same steps with rollup@0.68.2 does not produce warnings.

Looking in node_modules/rollup/dist/rollup.es.js I see:

import acorn__default, { Parser } from 'acorn';
//     ^--- grabs the default export and calls it acorn__default

Looking in node_modules/acorn/dist/acorn.mjs:

export { version, parse, parseExpressionAt, tokenizer, Parser, defaultOptions, Position, SourceLocation, getLineInfo, Node, TokenType, types as tokTypes, keywords$1 as keywordTypes, TokContext, types$1 as tokContexts, isIdentifierChar, isIdentifierStart, Token, isNewLine, lineBreak, lineBreakG, nonASCIIwhitespace };
//       ^--- long list of exports, none of which are default

I've not yet attempted to trace the origin of the default import.

Workaround

I've been able to temporarily work around this using the NormalModuleReplacementPlugin to redirect ^rollup$ to the non-ESM version.


Excited to be upgrading to the v1.0.0 release, congratulations! 🎉

@lukastaegert
Copy link
Member

This was a little tricky (and why do you even do that!?), fix at #2636.

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

Successfully merging a pull request may close this issue.

2 participants