Parcel: scopeHoist:true throws error

Created on 16 Aug 2019  路  3Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

馃帥 Configuration (.babelrc, package.json, cli command)

const options =
{
    autoInstall: false,
    contentHash: false,
    hmr: reload,
    logLevel: 1,
    outDir: `${__dirname}/../build`,
    publicUrl: './',
    scopeHoist: true,
    sourceMaps: debug,
    watch
};

馃 Expected Behavior

Shouldn't throw an error.

馃槸 Current Behavior

Cannot read property 'length' of undefined
    at JSConcatPackager.addAsset (/project/node_modules/parcel-bundler/src/packagers/JSConcatPackager.js:184:21)
    at Bundle._addDeps (/project/node_modules/parcel-bundler/src/Bundle.js:250:20)
    at Bundle._package (/project/node_modules/parcel-bundler/src/Bundle.js:219:18)
    at async Promise.all (index 0)
    at async Bundle.package (/project/node_modules/parcel-bundler/src/Bundle.js:202:5)
    at async Promise.all (index 1)
    at async Bundle.package (/project/node_modules/parcel-bundler/src/Bundle.js:202:5)
    at async Bundler.bundle (/project/node_modules/parcel-bundler/src/Bundler.js:325:27)
(node:48797) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
    at JSConcatPackager.addAsset (/project/node_modules/parcel-bundler/src/packagers/JSConcatPackager.js:184:21)
    at Bundle._addDeps (/project/node_modules/parcel-bundler/src/Bundle.js:250:20)
    at Bundle._package (/project/node_modules/parcel-bundler/src/Bundle.js:219:18)
    at async Promise.all (index 0)
    at async Bundle.package (/project/node_modules/parcel-bundler/src/Bundle.js:202:5)
    at async Promise.all (index 1)
    at async Bundle.package (/project/node_modules/parcel-bundler/src/Bundle.js:202:5)
    at async Bundler.bundle (/project/node_modules/parcel-bundler/src/Bundler.js:325:27)

馃拋 Possible Solution

set scropeHoist to false.

馃敠 Context

馃捇 Code Sample

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel |1.12.3
| Node |12.8.0
| npm/Yarn |6.10.2
| Operating System |macOS 10.14.6

Bug 馃尦 Tree Shaking

All 3 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

Same issue with:
Parcel 1.12.4
Node 12.17.0
npm 6.14.5
OS Ubuntu 18.04

@Anton-4 does this still occur with Parcel 2, if it does please open a new issue as this issue is quite old and nobody ever really provided a reproducable or anything we can use to debug this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jzimmek picture jzimmek  路  3Comments

will-stone picture will-stone  路  3Comments

dotdash picture dotdash  路  3Comments

oliger picture oliger  路  3Comments

algebraic-brain picture algebraic-brain  路  3Comments