-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.build.ts
55 lines (53 loc) · 1.31 KB
/
vite.config.build.ts
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
import { defineConfig } from "vite";
const path = require("path");
const atImport = require("postcss-import");
const { banner, projRootDirName, projRootDir } = require("./scripts/common")
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
var isProd = mode === 'production';
console.log("process.env", process.env);
return {
resolve: {
alias: [
{
find: "@",
replacement: path.resolve(
__dirname,
`./${projRootDir}/_bundle/src`
),
},
],
},
css: {
preprocessorOptions: {
scss: {
charset: false,
additionalData: `@import "@/styles/variables.scss";`,
},
postcss: {
plugins: [atImport({ path: path.join(__dirname, "src`") })],
},
},
},
plugins: [],
build: {
minify: isProd,
sourcemap: !isProd,
emptyOutDir: false,
outDir: `./dist`,
rollupOptions: {
input: {
index: `./${projRootDir}/_bundle/src/index.ts`,
default: `./${projRootDir}/_bundle/src/default.scss`,
},
output: {
banner,
assetFileNames: `[name].[ext]`,
entryFileNames: "[name].js",
chunkFileNames: "[name]-[hash].js",
},
},
},
}
}
);