Closed
Description
Describe the bug
emitCss: false
behave differently when set inside svelte.config.js
compared to when passed as a parameter directly to vite-plugin-svelte
. It completely strips all CSS from the output build, instead of inlining it in the resulting JS as expected.
Reproduction
Setup
npm init vite
- Select "svelte > svelte-ts" preset
npm install
Vite Config
- Modify
vite.config.js
to includeemitCss: false
export default defineConfig({ plugins: [svelte({ emitCss: false })] })
npm run build
- Observe that a CSS file is not written to disk.
- Verify that
dist/assets/index.*.js
contains the required CSS. Searching for "text-align" is a quick check.
Svelte Config
- Revert changes to
vite.config.js
from previous test. - Modify
svelte.config.js
to includeemitCss: false
export default { emitCss: false, preprocess: sveltePreprocess() }
npm run build
- Observe that a CSS file is not written to disk.
- It would be expected that
dist/assets/index.*.js
contains the required CSS. Searching for "text-align" is a quick check. It does not and no style information is written as part of the build.
Logs
No response
System Info
System:
OS: Windows 10 10.0.19043
CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
Memory: 8.97 GB / 15.95 GB
Binaries:
Node: 14.15.5 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.20.3 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 94.0.4606.71
Edge: Spartan (44.19041.1023.0), Chromium (94.0.992.38)
Internet Explorer: 11.0.19041.1202
npmPackages:
@sveltejs/vite-plugin-svelte: ^1.0.0-next.11 => 1.0.0-next.27
svelte: ^3.37.0 => 3.43.2
vite: ^2.6.4 => 2.6.7
Severity
annoyance