forked from jaywcjlove/oscnews
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.kktrc.js
62 lines (58 loc) · 1.76 KB
/
.kktrc.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
const CleanWebpackPlugin = require('clean-webpack-plugin');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const PATH = require('path');
module.exports = {
plugins: [
require.resolve('@kkt/plugin-less'),
],
// Modify the webpack config
config: (conf, { dev, env, ...other }, webpack) => {
conf = {
...conf,
mode: env === 'prod' ? 'production' : 'development',
devtool: 'source-map',
entry: other.appIndex,
output: {
filename: 'js/[hash:8].[name].js',
path: PATH.join(__dirname, 'oscnews'),
},
plugins: [
...conf.plugins.filter(item => item.constructor && item.constructor.name !== 'HotModuleReplacementPlugin'),
new CleanWebpackPlugin(['oscnews'], {
root: process.cwd(),
}),
new FileManagerPlugin({
onEnd: [{
copy: [
{ source: './chrome-main/manifest.json', destination: './oscnews/manifest.json' },
{ source: './chrome-main/background.js', destination: './oscnews/background.js' },
{ source: './chrome-main/osc-logo.png', destination: './oscnews/osc-logo.png' },
{ source: './src/dev-site/public/icons', destination: './oscnews/icons' },
],
}],
}),
]
}
conf = {
...conf,
optimization: {
...conf.optimization,
// https://webpack.js.org/plugins/split-chunks-plugin/
// splitChunks: {
// }
}
};
if (env === 'prod') {
// conf = {
// ...conf,
// optimization: {
// ...conf.optimization,
// // https://webpack.js.org/plugins/split-chunks-plugin/
// splitChunks: {
// }
// }
// };
}
return conf;
},
};