When running `svite build`, NODE_ENV is set to "development" instead of "production"
zakkor opened this issue · 3 comments
zakkor commented
Description
I would have expected process.env.NODE_ENV
to be set to "production" when running svite build
, but it seems like this is not happening, (at least inside tailwind.config.js), which breaks unused CSS removal for Tailwind
Default expected is "production":
-m, --mode [string] specify env mode >>>(default: "production")<<<
Doing svite build -m production
still provides the same results
A temporary workaround is to do NODE_ENV=production svite build
$ ./node_modules/.bin/svite build --debug
vite:config env mode: undefined +0ms
vite:config env: {} +2ms
svite: adding svite plugin to vite +0ms
svite: disabling vue support in vite +56ms
Building for production...
svite: svelte config used for build {
format: 'esm',
generate: 'dom',
css: false,
emitCss: true,
extensions: [ '.svelte' ],
preprocess: [ { style: [AsyncFunction: style] } ],
onwarn: [Function: onwarn],
dev: true
} +81ms
svite: +1ms
vite:build:resolve /src/index.js --> /REPO/src/index.js +0ms
process.env.NODE_ENV: development
Reproduction
The issue is reproducible in the postcss-tailwind
example straight out of the box
Additional Information
- operating system: NixOS
- versions for
- node v12.15.0
- npm 6.13.4
- yarn 1.22.4
- svite 0.5.0
- vite v1.0.0-rc.4
- svelte 3.24.1
- logs
- use logLevel: 'debug' in svite config
- start vite with
vite --debug
flag
dominikg commented
should be fixed in svite-0.6.0 (published just now)
dominikg commented
npm run build of postcss-tailwind example outputs purged css:
[write] dist/_assets/index.829ebdbf.js 2.81kb, brotli: 1.23kb
[write] dist/_assets/style.47c978a8.css 5.70kb, brotli: 1.37kb
[write] dist/index.html 0.38kb, brotli: 0.16kb
zakkor commented
Confirmed! Thanks for the quick resolution