SolidJSS
SolidJSโ€ข10mo agoโ€ข
4 replies
Chris

Prod Environment Variables Please

I'm maybe just doing something silly but when i do an npm run dev i can access env variables but not after an npm run build, i made a simple reproduction:

- npm create solid => basic => ts
app.config.ts:
import { defineConfig } from '@solidjs/start/config'

export default defineConfig({
  middleware: './src/middleware.ts',
})


middleware.ts:
import { createMiddleware } from '@solidjs/start/middleware'

export default createMiddleware({
  async onRequest () {
    console.log('process.env.test', process.env.test)
  },
})


.env: test=aloha

-
npm run dev
refresh app, see log of env variable
-
npm run build
and then
npm run start
, refresh app, env variable log is undefined ๐Ÿ˜…
Was this page helpful?