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

Change import assertions to import attributes #9907

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

harahu
Copy link
Contributor

@harahu harahu commented Sep 5, 2024

I couldn't get the project to build on Node v22, so I looked around and found this issue: https://stackoverflow.com/questions/78876691/syntaxerror-unexpected-identifier-assert-on-json-import-in-node-v22

After following one of the proposals, swapping import assertions to import attributes, the project builds on node v22 just fine. However, this means it won't build on Node v17 anymore.

@bhousel
Copy link
Member

bhousel commented Sep 5, 2024

Oh these things again.. This relates to #6014

@Snowysauce Snowysauce added javascript Pull requests that update Javascript code needs discussion Waiting for other contributors to voice their opinion labels Sep 6, 2024
@arch0345
Copy link
Collaborator

arch0345 commented Sep 9, 2024

Tried running build on this branch with v18/20/22 and it seems to be working

However, this means it won't build on Node v17 anymore

This shouldn't be a problem as package.json specifies that v18 or higher is required

"engines": {
"node": ">=18"
}

@bhousel
Copy link
Member

bhousel commented Sep 9, 2024

Yeah I think for now we might need to just stick to node 18 and 20.

@Snowysauce
Copy link
Collaborator

I've been using modified JS files with the suggested code changes in order to run the build and Wikidata scripts on Node 22. What I was/am doing was loading the modded files into my local clone of the repository, running the script, then discarding the changed JS files prior to uploading the script output. I knew uploading the modded files would break compatibility for anyone running older versions of Node, and I didn't want to unilaterally force others to upgrade.

@harahu
Copy link
Contributor Author

harahu commented Sep 9, 2024

Yeah I think for now we might need to just stick to node 18 and 20.

Not sure I understand what you mean here. This PR is compatible with all versions >= 18, including 18 and 20, so that means you think this is fine to merge? Or do you mean that it is a goal to avoid compatibility with v22?

Edit: To be clear, my goal is not to introduce official support for v22. I just think it's nice that the project happens to build on v22, particularly when that can be achieved with relatively little effort, like is the case here.

@bhousel
Copy link
Member

bhousel commented Sep 10, 2024

oh nice! I didn't realize that the with syntax was backported to v18 and 20

nodejs/node#51622
nodejs/node#51136

In that case, then yes, we should just switch to the accepted syntax. Thanks for the PR!

@bhousel bhousel merged commit eecfbc2 into osmlab:main Sep 10, 2024
2 checks passed
bhousel added a commit that referenced this pull request Sep 10, 2024
(re: #9907)

Need new versions of 18, 20 to support `with` import attributes syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code needs discussion Waiting for other contributors to voice their opinion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants