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

Document need for engines in package.json #64

Closed
geoffrich opened this issue Sep 13, 2022 · 3 comments
Closed

Document need for engines in package.json #64

geoffrich opened this issue Sep 13, 2022 · 3 comments

Comments

@geoffrich
Copy link
Owner

As of 7 days ago, SvelteKit now uses Node 15+ syntax ||= at build time: https://github.com/sveltejs/kit/blob/616ec7acace562b4517e1dae6c2fab159f055b78/packages/kit/src/core/sync/write_types/index.js#L510

This caused issues when updating the demo app to the latest adapter in geoffrich/sveltekit-azure-swa-demo#8, since the build uses Node 14 by default:

 error during build:
SyntaxError: Unexpected token '||='
    at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sveltekit-azure-swa-demo@0.0.1 build: `vite build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sveltekit-azure-swa-demo@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2022-09-13T00_05_13_864Z-debug.log

I fixed this by specifying engines in the project's package.json:

	"engines": {
		"node": ">=16.7 <17.0"
	}

This should be documented in the adapter README. Before that, we should verify that this is the correct solution and there isn't a better workaround.

@geoffrich
Copy link
Owner Author

geoffrich commented Oct 30, 2022

Thought: should this be fixed upstream in create-svelte? i.e. the default project template set the expected engines.

@geoffrich
Copy link
Owner Author

It's worth noting that the ||= syntax is no longer present in the build code, though that's not a guarantee that similar syntax won't be added in the future.

@geoffrich
Copy link
Owner Author

I'm closing this since it no longer appears to be necessary. I removed it from the demo app in #104 and it still deployed. Can re-open this if we need to address it.

@geoffrich geoffrich closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2023
@geoffrich geoffrich mentioned this issue Jan 1, 2024
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

1 participant