-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite.config.js
59 lines (57 loc) · 1.58 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
/**
* @type {import('vite').UserConfig}
*/
// import legacy from '@vitejs/plugin-legacy'
var path = require('path');
import tsconfigPaths from 'vite-tsconfig-paths';
import loadCsv from 'rollup-plugin-csv';
import hackWebpack from './rollup-plugin/vite-plugin-hackWebpack';
const config = {
base: './',//构建后的资源引入路径,默认是'/'
resolve: {
alias: {
'@': path.resolve(__dirname, "src"),
}
},
build: {
target: 'es2015',
assetsInlineLimit: 0,//phaser 不能加载base64
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html'),
strategy: path.resolve(__dirname, 'strategy/index.html')
}
}
// rollupOptions: {
// // 请确保外部化那些你的库中不需要的依赖
// external: ['Phaser'],
// output: {
// // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
// globals: {
// Phaser: 'phaser'
// }
// }
// }
},
json: {
stringify: true,
},
server: {
host: "0.0.0.0",
port: 8000
},
plugins: [
hackWebpack(),
tsconfigPaths(),
loadCsv(),
// legacy({
// targets: ['ie 11'],
// additionalLegacyPolyfills: ['regenerator-runtime/runtime']
// }),
],
hmr: {
overlay: false
},
assetsInclude: ['png', 'mp3', 'wav', 'json'] //因为是通过 import.meta.globEager加载,被插件转换管道排除在外了,需要手动声明(https://cn.vitejs.dev/config/#assetsinclude)
}
export default config