You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to migrate our sveltekit from 1.0.0-next.355 to the latest version - 1.0.0-next.504, and adapter-node from 1.0.0-next.78 to 1.0.0-next.95.
yarn run dev and yarn run build -> yarn run preview are successfully done, but when I launch server by nodejs through node build/index.js.
I asked this issue in discord, I got few responses. Someone said there is similar issue when he migrated from esbuild to rollup, and adapter-node also migrated from esbuild since v93.
I think our source code migration is done correctly according to the sveltekit guideline, but I guess there is some building issue by adapter-node or vite with some of NPM packages since adapter-node changed from esbuild to rollup.
Reproduction
I found there are at least two endpoints in our project having building issue in sveltekit. I created a very minimal project with the latest sveltekit version.
Please follow the reproduction procedure in README.md at the following repository,
You can compare both main branch and downgrade-sveltekit branch how the server works in production by using node build
Logs
In our project, the following logs were produced by using `yarn run build -> node build` commands.
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/j_igarashi/Documents/git/UNDP-Data/geohub/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///Users/j_igarashi/Documents/git/UNDP-Data/geohub/build/server/chunks/variables-e4a6492e.js:126157:25
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:527:24)
at async Promise.all (index 1)
at async render_page (file:///Users/j_igarashi/Documents/git/UNDP-Data/geohub/build/server/index.js:2297:19)
at async resolve (file:///Users/j_igarashi/Documents/git/UNDP-Data/geohub/build/server/index.js:2787:22)
at async respond (file:///Users/j_igarashi/Documents/git/UNDP-Data/geohub/build/server/index.js:2825:22)
at async Array.ssr (file:///Users/j_igarashi/Documents/git/UNDP-Data/geohub/build/handler.js:19060:3)
The following log is when I downgraded adapter-node to 1.0.0-next.92.
> Using @sveltejs/adapter-node
✘ [ERROR] Could not resolve "pg-native"
node_modules/pg/lib/native/client.js:4:21:
4 │ var Native = require('pg-native')
╵ ~~~~~~~~~~~
You can mark the path "pg-native" as external to exclude it from the bundle, which will remove
this error. You can also surround this "require" call with a try/catch block to handle this
failure at run-time instead of bundle-time.
✘ [ERROR] No loader is configured for ".node" files: node_modules/canvas/build/Release/canvas.node
node_modules/canvas/lib/bindings.js:3:25:
3 │ const bindings = require('../build/Release/canvas.node')
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error during build:
Error: Build failed with 2 errors:
node_modules/canvas/lib/bindings.js:3:25: ERROR: No loader is configured for ".node" files: node_modules/canvas/build/Release/canvas.node
node_modules/pg/lib/native/client.js:4:21: ERROR: Could not resolve "pg-native"
at failureErrorWithLog
I saw this issue #6440, found now bundle everything in devDependencies. I moved @azure/storage-blob and pg to dependencies. Now my test repository works in production.
Describe the bug
We are trying to migrate our sveltekit from
1.0.0-next.355
to the latest version -1.0.0-next.504
, and adapter-node from1.0.0-next.78
to1.0.0-next.95
.yarn run dev
andyarn run build -> yarn run preview
are successfully done, but when I launch server by nodejs throughnode build/index.js
.I asked this issue in discord, I got few responses. Someone said there is similar issue when he migrated from esbuild to rollup, and
adapter-node
also migrated from esbuild since v93.I think our source code migration is done correctly according to the sveltekit guideline, but I guess there is some building issue by adapter-node or vite with some of NPM packages since adapter-node changed from esbuild to rollup.
Reproduction
I found there are at least two endpoints in our project having building issue in sveltekit. I created a very minimal project with the latest sveltekit version.
Please follow the reproduction procedure in README.md at the following repository,
https://github.com/UNDP-Data/sveltekit-build-test
Furthermore, I created another branch in the repo which has downgraded sveltekit.
https://github.com/UNDP-Data/sveltekit-build-test/tree/downgrade-sveltekit
You can compare both main branch and downgrade-sveltekit branch how the server works in production by using
node build
Logs
The following log is when I downgraded
adapter-node
to1.0.0-next.92
.Other logs for our testing source code are in UNDP-Data/sveltekit-build-test repo's README.
System Info
Our server is running in Azure AppService. The following log was generated in our repository in my laptop.
The following log is for our testing repository UNDP-Data/sveltekit-build-test. Also, it was generated in my laptop.
Severity
blocking an upgrade
Additional Information
Yesterday, I posted the same one in discussion (#7069).
The text was updated successfully, but these errors were encountered: