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

Test against Node v18 #9905

Closed
bertdeblock opened this issue May 11, 2022 · 8 comments
Closed

Test against Node v18 #9905

bertdeblock opened this issue May 11, 2022 · 8 comments

Comments

@bertdeblock
Copy link
Contributor

Node v18 is a current stable release and will be the next LTS. According to our Node support document, we should already be testing against.

@boris-petrov
Copy link
Contributor

I personally can't run ember-cli on Node 18. Running my project leads to:

Build Error (PostcssCompiler)                                                                                                                                 
                                                                                                                                                              
You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer

I believe that's because of a bug in source-map that has since been fixed but only released in a beta 0.8.0-beta.0. I've got a lower version than that coming from many, many dependencies. One of them is fast-sourcemap-concat. Even if I pin source-map to version 0.8.0-beta.0, I get an error from it:

Cannot find module 'source-map/lib/source-map/base64-vlq'
Require stack:
- /home/boris/project/node_modules/fast-sourcemap-concat/lib/vlq.js
- /home/boris/project/node_modules/fast-sourcemap-concat/lib/coder.js
- /home/boris/project/node_modules/fast-sourcemap-concat/lib/source-map.js
- /home/boris/project/node_modules/fast-sourcemap-concat/lib/index.js
- /home/boris/project/node_modules/broccoli-concat/index.js
- /home/boris/project/node_modules/ember-source/lib/concat-bundle.js
- /home/boris/project/node_modules/ember-source/lib/index.js
- /home/boris/project/node_modules/ember-cli/lib/models/package-info-cache/package-info.js
- /home/boris/project/node_modules/ember-cli/lib/models/package-info-cache/index.js
- /home/boris/project/node_modules/ember-cli/lib/models/project.js
- /home/boris/project/node_modules/ember-cli/lib/utilities/get-config.js
- /home/boris/project/node_modules/ember-cli/lib/utilities/instrumentation.js
- /home/boris/project/node_modules/ember-cli/lib/cli/index.js
- /usr/lib/node_modules/ember-cli/bin/ember

So I guess it's going to be pretty difficult to run ember-cli on Node 18...

@jacobq
Copy link
Contributor

jacobq commented May 27, 2022

Yes, I ran into that too (mozilla/source-map#452), though did not have trouble working around with a resolution. The issue you're seeing with fast-sourcemap-concat appears to be because it's using an ancient version (v0.4.3 / July 2015?):
https://github.com/ef4/fast-sourcemap-concat/blob/85d8f280892863f6736740ee41a1bcf5483b8646/lib/vlq.js#L3
and in v0.5.0 the project layout was changed: lib/source-map/x --> lib/x
It doesn't look like there have been any breaking changes to the function so maybe a PR to update it would be acceptable
Edit: I take that back... the decode function seems to have moved / been removed....

-const vlq = require('source-map/lib/source-map/base64-vlq');
+const vlq = require('source-map/lib/base64-vlq');

@boris-petrov
Copy link
Contributor

Actually I did manage to get ember-cli working on Node 18 even with all these "bad" versions of source-map by using NODE_OPTIONS=--no-experimental-fetch. I've put it in my build-tools and in my .zshrc so I can run ember serve. Works fine. Of course, that breaks some other apps like VSCode which says that this is an unknown option (it obviously uses a Node version < 18). I workaround that by using NODE_OPTIONS="" code... 😄 For now it's OK but a "real" solution would be nice.

@jacobq
Copy link
Contributor

jacobq commented May 27, 2022

Actually I did manage to get ember-cli working on Node 18 even with all these "bad" versions of source-map by using NODE_OPTIONS=--no-experimental-fetch. I've put it in my build-tools and in my .zshrc so I can run ember serve. Works fine. Of course, that breaks some other apps like VSCode which says that this is an unknown option (it obviously uses a Node version < 18). I workaround that by using NODE_OPTIONS="" code... 😄 For now it's OK but a "real" solution would be nice.

@boris-petrov You can also try this (ef4/fast-sourcemap-concat#66):

"resolutions": {
  "fast-sourcemap-concat": "jacobq/fast-sourcemap-concat#source-map-update"
}

@boris-petrov
Copy link
Contributor

boris-petrov commented May 30, 2022

@jacobq thanks for the help! I'll try if that works but note that fast-sourcemap-concat also depends on an old version of sourcemap-validator which in turn depends on source-map "~0.1.x" - not sure if that matters but...

P.S. So yes, adding these two to resolutions:

    "fast-sourcemap-concat": "jacobq/fast-sourcemap-concat#source-map-update",
    "source-map": "0.8.0-beta.0",

Makes my project build and work. Perhaps that's better than the NODE_OPTIONS=--no-experimental-fetch stuff... 😄

@jacobq
Copy link
Contributor

jacobq commented May 30, 2022

@jacobq thanks for the help! I'll try if that works but note that fast-sourcemap-concat also depends on an old version of sourcemap-validator which in turn depends on source-map "~0.1.x" - not sure if that matters but...

Gotcha, I hadn't noticed that... Looks like sourcemap-validator only uses SourceMapConsumer, but that interface maybe have changed...if nothing else, the moving from lib/source-map -> lib/ would require a change in how its used...

If you happen to want to work on it more, feel free to PR the @jacobq/source-map fork. I created it since the mozilla source-map maintainers do not appear to be making releases, accepting PRs, etc. anymore.

@boris-petrov
Copy link
Contributor

boris-petrov commented May 31, 2022

terser switched to some other source-map dependency - see here and here. Not sure if relevant but perhaps something similar can be done in fast-sourcemap-concat.

P.S. for the other issue about sourcemap-validator - as I mentioned above, my project seems to build fine so I prefer not spending time on trying to fix this. 😄 Not sure how source-map is used in sourcemap-validator but it doesn't break my build so I'm fine with that.

@bertdeblock
Copy link
Contributor Author

Ember CLI is now being tested against Node v18: #9944.
Is there anything left on Ember CLI's side for this issue to be resolved?

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

3 participants