I've installed and added this plugin like mentioned in the docs, but starting the compiling throws an exception (see below).
vite.config.ts:
import EnvCaster from '@niku/vite-env-caster'
export default defineConfig({
envPrefix: 'XYZ_',
plugins: [
EnvCaster(), // calling without options should be fine, right?
vue({/*...*/})
]
})
Error running npm run dev:
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
failed to load config from /speeddrive/webserver/vendor/frontends/my-project/vite.config.ts
error when starting dev server:
TypeError: EnvCaster is not a function
at file:///speeddrive/webserver/vendor/frontends/my-project/vite.config.ts.timestamp-1703252334437-371455b7ec957.mjs:11:5
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadConfigFromBundledFile (file:///speeddrive/webserver/vendor/frontends/my-project/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:68017:21)
at async loadConfigFromFile (file:///speeddrive/webserver/vendor/frontends/my-project/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:67874:28)
at async resolveConfig (file:///speeddrive/webserver/vendor/frontends/my-project/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:67475:28)
at async _createServer (file:///speeddrive/webserver/vendor/frontends/my-project/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:59972:20)
at async CAC.<anonymous> (file:///speeddrive/webserver/vendor/frontends/my-project/node_modules/vite/dist/node/cli.js:764:24)
I've installed and added this plugin like mentioned in the docs, but starting the compiling throws an exception (see below).
vite.config.ts
:Error running
npm run dev
:Environment (from
package.json
):npm v9.9.2 node v16.13.0
What can be the issue here?