-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
107 lines (104 loc) · 2.63 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { resolve } from "path";
import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { chromeExtension, simpleReloader } from "vite-plugin-chrome-extension";
import { createHtmlPlugin } from 'vite-plugin-html';
const mode = "development"; // production // development
const isProduction = mode === 'production'; // boolean
// https://vitejs.dev/config/
export default defineConfig({
mode: mode,
// optimizeDeps: {
// include: ["svelte-hero-icons"],
// },
logLevel: isProduction ? "silent" : "info",
// logLevel: "info",
plugins: [
svelte({
// emitCss: isProduction,
emitCss: true,
}),
createHtmlPlugin({
// minify: true,
// pages : [
// {
// entry: "src/newtab/index.js",
// template: "src/newtab/index.html",
inject: {
// data: {
// injectStylesheet: `<link rel="stylesheet" type="text/css" href="main.css" />`,
// injectScript: `<script type="module" src="main.js"></script>`,
// },
// tags: [
// {
// injectTo: 'head',
// tag: 'link',
// attrs: {
// href: 'main.css',
// rel: "stylesheet",
// type: "text/css"
// },
// },
// {
// injectTo: 'body',
// tag: 'script',
// attrs: {
// src: 'main.js',
// type: "module"
// },
// },
// ],
},
// }],
}),
chromeExtension(
{
// verbose: true,
// dynamicImportWrapper: true,
// contentScriptWrapper: false,
}
),
// {
// name: 'disable-treeshake',
// transform(code, id) {
// if (id.endsWith('.html')) {
// console.log(id);
// return { moduleSideEffects: 'no-treeshake' };
// }
// },
// },
// simpleReloader(),
],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
emptyOutDir: false,
cssCodeSplit: true,
assetsDir: 'assets',
build: {
rollupOptions: {
input: {
manifest: resolve(__dirname, "src/manifest.json"),
},
output: {
name: "expressiontab",
entryFileNames: "[name].js",
assetFileNames: "[name].[ext]"
},
},
// watch: {
// buildDelay: 1000,
// chokidar: true,
// clearScreen: false,
// include: resolve(__dirname + "/src/**"),
// skipWrite: true,
// },
outDir: "builds/expressiontab",
external: true,
// sourcemap: 'inline',
assetsInlineLimit: 0,
minify: 'terser',
},
});