2021-04-02 19:56:57 +00:00
|
|
|
import svelte from '@sveltejs/vite-plugin-svelte';
|
2021-03-25 17:55:24 +00:00
|
|
|
import { minify } from 'html-minifier';
|
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
//
|
|
|
|
const indexReplace = () => {
|
|
|
|
return {
|
|
|
|
name: 'html-transform',
|
|
|
|
transformIndexHtml(html) {
|
|
|
|
return minify(html, {
|
|
|
|
collapseWhitespace: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default defineConfig(({ command, mode }) => {
|
|
|
|
const isProduction = mode === 'production';
|
|
|
|
return {
|
2021-04-02 19:07:16 +00:00
|
|
|
// base: './',
|
2021-03-25 17:55:24 +00:00
|
|
|
build: {
|
|
|
|
polyfillDynamicImport: false,
|
|
|
|
cssCodeSplit: false,
|
|
|
|
minify: isProduction
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
svelte({
|
|
|
|
//@ts-ignore
|
|
|
|
hot: !isProduction,
|
|
|
|
emitCss: true,
|
|
|
|
extensions: [ '.md', '.svx', '.svelte' ],
|
|
|
|
preprocess: [
|
|
|
|
//
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
indexReplace()
|
|
|
|
]
|
|
|
|
};
|
|
|
|
});
|