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

Tree shaking fails for my project #1971

Closed
mvlabat opened this issue Aug 31, 2018 · 2 comments
Closed

Tree shaking fails for my project #1971

mvlabat opened this issue Aug 31, 2018 · 2 comments

Comments

@mvlabat
Copy link
Contributor

mvlabat commented Aug 31, 2018

Hi everyone! I've just tried to test tree shaking on my project, but unfortunately it fails.
Steps to reproduce the error:

git clone git@github.com:Gitlings/platformio.git
cd platformio/frontend
yarn install
yarn parcel build index.html --experimental-scope-hoisting

Here's what I get:

yarn run v1.9.4
$ /var/www/platformio/frontend/node_modules/.bin/parcel build index.html --experimental-scope-hoisting
⠋ Building...lscpu: failed to determine number of CPUs: /sys/devices/system/cpu/possible: No such file or directory
🚨  Unexpected token, expected ; (2:19)
    at Parser.pp$5.raise (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp.semicolon (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:1742:38)
    at Parser.pp$1.parseVarStatement (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:2170:8)
    at Parser.pp$1.parseStatement (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:1861:19)
    at Parser.pp$1.parseBlockBody (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:2268:21)
    at Parser.pp$1.parseTopLevel (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:1778:8)
    at Parser.parse (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:1673:17)
    at Object.parse (/var/www/platformio/frontend/node_modules/babylon/lib/index.js:7305:37)
    at JSConcatPackager.parse (/var/www/platformio/frontend/node_modules/parcel-bundler/src/packagers/JSConcatPackager.js:346:23)
    at JSConcatPackager.addDeps (/var/www/platformio/frontend/node_modules/parcel-bundler/src/packagers/JSConcatPackager.js:236:25)
    at JSConcatPackager.addDeps (/var/www/platformio/frontend/node_modules/parcel-bundler/src/packagers/JSConcatPackager.js:225:25)
    at JSConcatPackager.addDeps (/var/www/platformio/frontend/node_modules/parcel-bundler/src/packagers/JSConcatPackager.js:225:25)
    at JSConcatPackager.end (/var/www/platformio/frontend/node_modules/parcel-bundler/src/packagers/JSConcatPackager.js:442:36)
    at Bundle._package (/var/www/platformio/frontend/node_modules/parcel-bundler/src/Bundle.js:199:20)
    at <anonymous>
error Command failed with exit code 1.

Sorry for a little bean mean description. Would be glad to help with any other information

Software Version(s)
Parcel 1.9.7
Node 9.11.1
Yarn 1.9.4
Operating System Debian GNU/Linux 8 (jessie)
@mvlabat
Copy link
Contributor Author

mvlabat commented Aug 31, 2018

Oh, inserting some logging statements inside babylon lib, I've found out that it fails on my frontend/gui/PlayerInfoBar.vue file.
Seems to be a bug that this PR tries to address: #1735

@lukaszsamson
Copy link

Stumbled into this in my project. I took a look at the code that crashes babylon. It seems sometimes bad variable names are generated like

var $lRJ$exports={};$parcel$require("l/RJ","vue-property-decorator");var $lRJ$var$_typeof="function"==typeof Symbol&&"
(...)
var $l/RJ$exports = {};

or

var $hAc$exports={};$parcel$require("h/ac","vue-property-decorator");var $hAc$var$_createClass=function(){function e(
(...)
var $h/ac$exports = {};

Fortunately there is a simple workaround - changing the imported file name, e.g.
it was failing for ./src/Entries.vue and changing file name to ./src/EntriesTable.vue made it work.

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

No branches or pull requests

4 participants