question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[2.0.alpha.3.1] parcel works, parcel build does not - "External modules are not supported when building for browser"

See original GitHub issue

🐛 bug report

parcel src/index.html works, but parcel build src/index.html does not.

🎛 Configuration (.babelrc, package.json, cli command)

Nothing overly fancy; see the entire test branch: https://github.com/wojtekmaj/react-lifecycle-methods-diagram/tree/parcel-2

🤔 Expected Behavior

parcel build ... command builds production bundle.

😯 Current Behavior

$ parcel build src/index.html --no-source-maps
🚨 @parcel/packager-js: External modules are not supported when building for browser
Error: External modules are not supported when building for browser
    at Object.generateExternalImport (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@parcel/scope-
hoisting/lib/formats/global.js:50:9)
    at exit (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@parcel/scope-hoisting/lib/link.js:549:
23)
    at NodePath._call (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse/lib/path/cont
ext.js:55:20)
    at NodePath.call (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse/lib/path/conte
xt.js:42:17)
    at NodePath.visit (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse/lib/path/cont
ext.js:99:8)
    at TraversalContext.visitQueue (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse/
lib/context.js:112:16)
    at TraversalContext.visitSingle (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse
/lib/context.js:84:19)
    at TraversalContext.visit (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse/lib/c
ontext.js:140:19)
    at Function.traverse.node (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse/lib/i
ndex.js:84:17)
    at traverse (/Users/wojciech.maj/Projekty/react-lifecycle-methods-diagram/node_modules/@babel/traverse/lib/index.js:66:12)
error Command failed with exit code 1.

💻 Code Sample

https://github.com/wojtekmaj/react-lifecycle-methods-diagram/tree/parcel-2

The branch only contains absolute minimum set of changes I needed to do to make Parcel 2 work on development environment. All the rest is unchanged and successfully builds with Parcel 1.

🌍 Your Environment

Software Version(s)
Parcel 2.0.0.alpha.3.1
Node 12.13.0
Yarn 1.19.0
Operating System macOS Catalina

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
devongovettcommented, Dec 3, 2019

Should be fixed by #3863.

3reactions
devongovettcommented, Dec 2, 2019

I’m working on changing the behavior for this to only put you in library mode if the destination filename is a .js file. If you put a .html file in the browser or main field, it should build as an application.

Read more comments on GitHub >

github_iconTop Results From Across the Web

parcel/packager-js: External modules are not supported when ...
I cannot get rid of this error, every time a try to build I get: Build failed. @parcel/packager-js: External modules are not supported...
Read more >
Building with parcel for the browser - how to not output ...
One key thing is that I'd like it not to bundle external dependencies (e.g. jQuery) because they may already be present in sites...
Read more >
Migration - Parcel
The first thing to note when upgrading from Parcel 1 to Parcel 2 is that the npm package name has changed from parcel-bundler...
Read more >
@parcel/fs NPM | npm.io
Automatically transforms modules using Babel, PostCSS, and PostHTML when needed - even node_modules . ✂️ Zero configuration code splitting using dynamic ...
Read more >
Gatsby Changelog | 5.3.0
Please note: The TypeScript variants of gatsby-config and gatsby-node do not support ESM yet. We plan on adding support in a future minor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found