forked from imguolao/monaco-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbk.config.js
79 lines (77 loc) · 2.11 KB
/
bk.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
const { resolve } = require('path');
const isProduction = process.env.NODE_ENV === 'production';
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
module.exports = {
appConfig() {
const config = {
indexPath: './index.html',
mainPath: './src/main.ts',
// publicPath: '',
// outputDir: __dirname + '/dist',// 打包输出目录
assetsDir: '',
devServer: {
host: '127.0.0.1',
// host: 'local.zhoulujun.net',
port: 9014,
}
}
if (isProduction) {
Object.assign(config, {
minChunkSize: 10000000,
target: 'lib',
needSplitChunks: false,
classificatoryStatic: false,
library: 'MonacoEditor', // 库名,在全局环境下被挂载在window下
})
}
return config
},
configureWebpack(_webpackConfig) {
webpackConfig = _webpackConfig;
webpackConfig.resolve = {
...webpackConfig.resolve,
symlinks: false,
extensions: ['.js', '.vue', '.json', '.ts', '.tsx'],
alias: {
...webpackConfig.resolve?.alias,
// extensions: ['.js', '.jsx', '.ts', '.tsx'],
'@': resolve(__dirname, './src'),
},
};
webpackConfig.plugins.push(
new MonacoWebpackPlugin({
// available options are documented at
// https://github.com/Microsoft/monaco-editor-webpack-plugin#options
languages: ['json']
})
)
// debugger;
// webpackConfig.stats = {
// ...webpackConfig.stats,
// children: true,
// }
// webpackConfig.module.rules.push(
// {
// test: /\.worker\.js$/,
// use: { loader: 'worker-loader' },
// },
// )
if (isProduction) {
webpackConfig.entry = {
index: './src/index.ts',
}
webpackConfig.externals = {
'vue': 'vue',
'monaco-editor': 'monaco-editor',
'monaco-promql': 'monaco-promql',
'bkui-vue': 'bkui-vue',
}
webpackConfig.output = {
path: resolve(__dirname, './dist'),
filename: '[name].js',
publicPath: '',
libraryTarget: 'umd',
}
}
},
};