glimmerjs / glimmer-vm

MIT License
1.13k stars 190 forks source link

Cannot build for production when using `--web-component` argument. (uglifyjs) #452

Closed WillsonSmith closed 7 years ago

WillsonSmith commented 7 years ago

This is possibly more well suited for the ember-cli repo, but is directly related to Glimmer.

When starting a new glimmer app with

ember new my-app -b @glimmer/blueprint --web-component

It is not possible to build with the --environment production flag.

My theory is that the code is not being transpiled before hitting uglify, so uglify doesn't know how to parse it.

Build fail message:

Build failed.
File: app.js (7:6)
The Broccoli Plugin: [UglifyWriter] failed with:
SyntaxError: The Broccoli Plugin: [UglifyWriter] failed with:
    at JS_Parse_Error.get (eval at <anonymous> (/Users/willsonsmith/Documents/web/test-build/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:86:23)
    at writeError (/Users/willsonsmith/Documents/web/test-build/node_modules/console-ui/lib/write-error.js:23:23)
    at UI.writeError (/Users/willsonsmith/Documents/web/test-build/node_modules/console-ui/lib/index.js:159:3)
    at CLI.logError (/Users/willsonsmith/Documents/web/test-build/node_modules/ember-cli/lib/cli/cli.js:275:13)
    at tryCatch (/Users/willsonsmith/Documents/web/test-build/node_modules/rsvp/dist/rsvp.js:539:12)
    at invokeCallback (/Users/willsonsmith/Documents/web/test-build/node_modules/rsvp/dist/rsvp.js:554:13)
    at publish (/Users/willsonsmith/Documents/web/test-build/node_modules/rsvp/dist/rsvp.js:522:7)
    at publishRejection (/Users/willsonsmith/Documents/web/test-build/node_modules/rsvp/dist/rsvp.js:457:3)
    at flush (/Users/willsonsmith/Documents/web/test-build/node_modules/rsvp/dist/rsvp.js:2414:5)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)

steps to reproduce

  1. ember new my-app -b @glimmer/blueprint --web-component
  2. ember build --environment production

expected: would build actual: fails to build

ember build with no env works, as well as using ember build --environment development

pittst3r commented 7 years ago

Thanks for the issue! This is a known issue and we have one open already in the web-component repo. The problem is that uglify can't handle es2015+. We're working on it!

WillsonSmith commented 7 years ago

Thanks! I'll close this and leave a link to the issue in web-component. https://github.com/glimmerjs/glimmer-web-component/issues/7