Closed tom-brulin closed 6 months ago
did you set NODE_ENV
to production
in your build ?
Oh yeah that's working like a charm right now.
I just copied the default env, and I forgot to change the NODE_ENV
Thanks to you.
doesn't work on windows
{
"level": 60,
"time": 1712363053805,
"pid": 12032,
"hostname": "DESKTOP-BOSTFRL",
"request_id": "yx7s6nxjwkbl5zc7ln43awd0",
"err": {
"type": "Error",
"message": "Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'",
"stack": "Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'\n at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239:11)\n at defaultLoad (node:internal/modules/esm/load:130:3)\n at ModuleLoader.load (node:internal/modules/esm/loader:403:13)\n at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:56)\n at new ModuleJob (node:internal/modules/esm/module_job:67:26)\n at #createModuleJob (node:internal/modules/esm/loader:297:17)\n at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:254:34)\n at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:235:17)\n at async ModuleLoader.import (node:internal/modules/esm/loader:322:23)",
"code": "ERR_UNSUPPORTED_ESM_URL_SCHEME",
"status": 500
},
"msg": "Exception raised by error handler"
}
TZ=UTC
PORT=3333
HOST=localhost
LOG_LEVEL=info
APP_KEY=YhOBs4czdPkg4PqeL4eVoYn93qJWQS8V
NODE_ENV=production
SESSION_DRIVER=cookie
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASSWORD=
DB_DATABASE=testing
import { defineConfig } from '@adonisjs/inertia';
export default defineConfig({
rootView: 'inertia_layout',
sharedData: {
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
},
ssr: {
enabled: true,
entrypoint: 'inertia/app/ssr.tsx'
}
});
//# sourceMappingURL=inertia.js.map
doesn't work on windows
LOG
{ "level": 60, "time": 1712363053805, "pid": 12032, "hostname": "DESKTOP-BOSTFRL", "request_id": "yx7s6nxjwkbl5zc7ln43awd0", "err": { "type": "Error", "message": "Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'", "stack": "Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'\n at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239:11)\n at defaultLoad (node:internal/modules/esm/load:130:3)\n at ModuleLoader.load (node:internal/modules/esm/loader:403:13)\n at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:56)\n at new ModuleJob (node:internal/modules/esm/module_job:67:26)\n at #createModuleJob (node:internal/modules/esm/loader:297:17)\n at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:254:34)\n at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:235:17)\n at async ModuleLoader.import (node:internal/modules/esm/loader:322:23)", "code": "ERR_UNSUPPORTED_ESM_URL_SCHEME", "status": 500 }, "msg": "Exception raised by error handler" }
ENV
TZ=UTC PORT=3333 HOST=localhost LOG_LEVEL=info APP_KEY=YhOBs4czdPkg4PqeL4eVoYn93qJWQS8V NODE_ENV=production SESSION_DRIVER=cookie DB_HOST=127.0.0.1 DB_PORT=3306 DB_USER=root DB_PASSWORD= DB_DATABASE=testing
PROBLEM
import { defineConfig } from '@adonisjs/inertia'; export default defineConfig({ rootView: 'inertia_layout', sharedData: { errors: (ctx) => ctx.session?.flashMessages.get('errors'), }, ssr: { enabled: true, entrypoint: 'inertia/app/ssr.tsx' } }); //# sourceMappingURL=inertia.js.map
me too in windows 11
Package version
1.0.0-18
Describe the bug
Hi,
I am experiencing an issue while trying to deploy a fresh AdonisJS app using inertia starter kit with React and SSR.
To run a production build I use the following commands since the
npm run start
command doesn't workThe error
After some research, I just copied the inertia directory to the build directory, and it work but I am wondering if it should work like that ?
Reproduction repo
https://github.com/tom-brulin/adonis-inertia-react-ssr-deploy-test