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

Using ember-moment in Ember 3.18 fails to produce production build #328

Closed
deanmraz opened this issue May 6, 2020 · 8 comments
Closed

Comments

@deanmraz
Copy link

deanmraz commented May 6, 2020

Issue

Cannot create production builds. Fails during uglify.

Steps

  1. Create new ember app npm i -g ember-cli && ember new ember-moment-test
  2. Install ember moment cd ember-moment-test && ember install ember-moment
  3. Run production build ember build --environment=production

Error

Build Error (UglifyWriter)

Unexpected token: eof (undefined)

...

ERROR Summary:

  - broccoliBuilderErrorStack: SyntaxError: Unexpected token: eof (undefined)
    at ee (~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:19541)
    at c (~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:28031)
    at l (~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:28122)
    at f (~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:28175)
    at N (~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:38279)
    at ~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:30375
    at ~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:28763
    at ~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:32107
    at ~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:32217
    at ~/projects/ember-moment-test/node_modules/terser/dist/bundle.min.js:1:28763
  - code: [undefined]
  - codeFrame: Unexpected token: eof (undefined)
  - errorMessage: Unexpected token: eof (undefined)
        at UglifyWriter

...

@mschorsch
Copy link

We have the same problem with [email protected] and sometimes get the following error (only in production build):

...
Merge error: conflicting capitalizations:
moment/locale/en-SG.js in /tmp/broccoli-14632r7VYmVxi9CXp/out-118-broccoli_persistent_filter_mapper
moment/locale/en-sg.js in /tmp/broccoli-14632r7VYmVxi9CXp/out-118-broccoli_persistent_filter_mapper
Remove one of the files and re-add it with matching capitalization.
...

The problem seems to be moment itself. Since moment@^2.25.0 the file en-SG.js was renamed to en-sg.js.

@dmaok
Copy link

dmaok commented May 7, 2020

@deanmraz I confirm the error with moment@^2.25.0.
Just specify "moment": "2.24.0" for submodules.
instruction for yarn, instruction for npm

@deanmraz
Copy link
Author

deanmraz commented May 7, 2020

@dmaok How would you implement that? It looks like npm pulled both versions of moment 2.24.0 & 2.25.0.

@dmaok
Copy link

dmaok commented May 8, 2020

@deanmraz, it is easier with yarn. In your package.json add block

  "resolutions": {
    "moment": "2.24.0"
  }

and then yarn install

@deanmraz
Copy link
Author

deanmraz commented May 8, 2020

@dmaok that worked, thank you!

This is a good short term fix, but what is the ideal solution? Does this need to be fixed in this repo or the actual moment repo?

@jrjohnson
Copy link

According to terser/terser#684 this is a moment issue though there isn't a specific ticket there yet https://github.com/moment/moment/issues

@jasonmit
Copy link
Collaborator

Fixed in [email protected] - thanks to @jrjohnson

@deanmraz
Copy link
Author

@jasonmit confirmed! thanks everyone for the help

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

No branches or pull requests

5 participants