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

Can't build for production since moment v2.25.1 released #183

Closed
elatonsev opened this issue May 7, 2020 · 10 comments · Fixed by #184
Closed

Can't build for production since moment v2.25.1 released #183

elatonsev opened this issue May 7, 2020 · 10 comments · Fixed by #184

Comments

@elatonsev
Copy link

Fixing moment version on 2.24.0 helps, but it is still an issue.

"resolutions": {
    "ember-cli-moment-shim/moment": "2.24.0"
}

adopted-ember-addons/ember-pikaday#343 (comment)

@arenoir
Copy link

arenoir commented May 9, 2020

I am also unable to build my application. Strangely it builds in development mode but not in test mode on circleci.

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

@jrjohnson
Copy link
Collaborator

I've been digging into this. It appears that moment.min.js in Moment 2.25.0+ is valid, but when it is used in an ember app it produces invalid JS which terser cannot process. I haven't figured out why yet. One possible option is for this addon to bundle the non-minified moment.js and let them consuming app handle minification as it does for other assets.

Terser Issue: terser/terser#684
Ember Moment Issue: adopted-ember-addons/ember-moment#328

@jasonmit
Copy link
Owner

Versioned in 3.8.0

@bmaehr
Copy link

bmaehr commented May 12, 2020

Fixing moment version on 2.24.0 helps, but it is still an issue.

"resolutions": {
    "ember-cli-moment-shim/moment": "2.24.0"
}

didn't fix it for me.

Neither 3.8.0 did it.

  - broccoliBuilderErrorStack: SyntaxError: Unexpected token: eof (undefined)
    at ee (/mnt/DATA/jenkins/workspace/pubx_Build_QA/ui/ui/src/main/emberapp/node_modules/terser/dist/bundle.min.js:1:19541)
[email protected], ember-cli-moment-shim@^3.6.0:
  version "3.8.0"
  resolved "https://registry.yarnpkg.com/ember-cli-moment-shim/-/ember-cli-moment-shim-3.8.0.tgz#dc61bbac9dce4963394e60dd42726d4ba38e2bc1"
  integrity sha512-dN5ImjrjZevEqB7xhwFXaPWwxdKGSFiR1kqy9gDVB+A5EGnhCL1uveKugcyJE/MICVhXUAHBUu6G2LFWEPF2YA==
  dependencies:
    broccoli-funnel "^2.0.0"
    broccoli-merge-trees "^2.0.0"
    broccoli-source "^1.1.0"
    broccoli-stew "^1.5.0"
    chalk "^1.1.3"
    ember-cli-babel "^7.1.2"
    ember-cli-import-polyfill "^0.2.0"
    ember-get-config ""
    lodash.defaults "^4.2.0"
    moment "^2.19.3"
    moment-timezone "^0.5.13"

Or

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

@bmaehr
Copy link

bmaehr commented May 12, 2020

Combining all together worked:

  "resolutions": {
    "ember-cli-moment-shim": "3.8.0",
    "moment": "2.24.0",
    "ember-cli-moment-shim/moment": "2.24.0"
  }

@zardaloop
Copy link

@bmaehr thanks for sharing this solution, it seems this is the only way for the time being to resolve this issue.

@jrjohnson
Copy link
Collaborator

jrjohnson commented May 18, 2020

It may be that you have other packages relying on the wrong version of ember-cli-moment-shim try running npm ls ember-cli-moment-shim or yarn list --pattern moment and see what shows up.

Or it may be that this fix didn't actually fix the issue, do you have an app or branch I can take a look at to test?

@zardaloop
Copy link

@jrjohnson Hi Johnathan. Thanks for your comment. It is actually an internal project we have. The problem is, we have many small internal ember addons, some of those addons have the ember-cli-moment-shim fixed to 3.7.1. So they don't have any hat "^". However it seems there are some other third party packages that we are using which are also using ember-cli-moment-shim and those have hat. Therefore since last week you released version 3.8.0 we are having that issue. If I use resolutions, it fixes the issue for the project (not a real fix but I can still serve it). But if I use npm link to link the other add-on to my main projects to work on those add-ons I still get the same error.

@jrjohnson
Copy link
Collaborator

That makes sense without the ^ you won't get this fix and will still need to pin the moment version. In fact with Ember addons you sometimes can't actually determine what version you will get. Highly recommend ember-cli-dependency-lint as a way to track down these conflicts and add tests to ensure they don't pop up again.

@zardaloop
Copy link

@jrjohnson Many thanks Johnathan, I did not know about that package. I will install it and will it a go.

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

Successfully merging a pull request may close this issue.

6 participants