No response
When setting NODE_ENV=production
on a plain Javascript build the admin interface fails to load on /admin
.
I believe it could be that the changes to defaults when process.env.NODE_ENV === 'production'
.
Saw mention of default base directory changing when NODE_ENV
is set to production
though struggle to find that documentation again.
/dist
cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js
2
No response
There should be a descriptive error.
The failure of the admin interface to be accessible may relate to this section taking a different path in the builder:
payload/packages/payload/src/express/admin.ts
Lines 5 to 9 in 4a54aa7
This may be when build:payload
(Which should be simply the webpack bundler) has failed to be ran. Due to failure on some systems.
With the TypeScript I had Error: unknown field cwd
same as other reports:
https://help.railway.app/questions/i-want-to-deploy-a-nextjs-project-with-p-dc946ee6
https://help.railway.app/questions/error-unknown-field-cwd-when-building-edc1598f
swc-project/swc#7538 (comment)
Now with a Javascript version of the files I get:
> cross-env PAYLOAD_CONFIG_PATH=src/payload.config.js payload build
/home/user/path/node_modules/@swc/wasm/wasm.js:489
const ret = new Error(getStringFromWasm0(arg0, arg1));
^
Error: invalid type: unit value, expected a map
Hey @mryellow - yes, you'll need to copy over your build
folder as well if you want to run Payload in production. Without a built copy of the admin UI, the admin UI will not work in production.
Give that a shot!
There is nothing in that directory which requires such opinionated build tooling.
(Tooling which was bugged and blocked the entire project from functioning.)
It's simply a directory of static assets. It could be committed.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.