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
I can deploy a svelte kit app (with the node adapter) with up but accessing it fails because of the usage of ES Modules ("type": "module" in the package.json file).
Since Node 14 allows ECMAScript modules natively and without flag, it would be lovely to use them with up with the Node 14.x runtime.
Here is what I get when I open the domain in my browser:
{"message": "Internal server error"}
And in up logs:
May 24th 05:10:50pm INFO 2021-05-24T15:10:50.444Z undefined ERROR Uncaught Exception {
"errorType": "Error",
"errorMessage": "Must use import to load ES Module: /var/task/_proxy.js\nrequire() of ES modules is not supported.\nrequire() of /var/task/_proxy.js from /var/runtime/UserFunction.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.\nInstead rename _proxy.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /var/task/package.json.\n",
"code": "ERR_REQUIRE_ESM",
"stack": [
"Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/task/_proxy.js",
"require() of ES modules is not supported.",
"require() of /var/task/_proxy.js from /var/runtime/UserFunction.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.",
"Instead rename _proxy.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /var/task/package.json.",
"",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13)",
" at Module.load (internal/modules/cjs/loader.js:928:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:769:14)",
" at Module.require (internal/modules/cjs/loader.js:952:19)",
" at require (internal/modules/cjs/helpers.js:88:18)",
" at _tryRequire (/var/runtime/UserFunction.js:75:12)",
" at _loadUserApp (/var/runtime/UserFunction.js:95:12)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1063:30)"
]
}
Thanks!
The text was updated successfully, but these errors were encountered:
Prerequisites
up upgrade
)-v, --verbose
flag.Description
I am using the Node.js 14.x runtime.
I can deploy a svelte kit app (with the node adapter) with up but accessing it fails because of the usage of ES Modules (
"type": "module"
in thepackage.json
file).Since Node 14 allows ECMAScript modules natively and without flag, it would be lovely to use them with up with the Node 14.x runtime.
Steps to Reproduce
To start, I init the svelte kit app:
npm init svelte@next my-app cd my-app npm install
Then, the node adapter:
Update the
svelte.config.js
: add the import and the adapter:Then, add the
up.json
file:Here is what I get when I open the domain in my browser:
And in up logs:
Thanks!
The text was updated successfully, but these errors were encountered: