Skip to content

Commit 16ffa88

Browse files
committed
chore(deps): Update kkt monorepo to v5.10.3
1 parent c34ce6e commit 16ffa88

File tree

3 files changed

+14842
-8746
lines changed

3 files changed

+14842
-8746
lines changed

.kktrc.js

Lines changed: 28 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,32 @@
1-
const CleanWebpackPlugin = require('clean-webpack-plugin');
2-
const FileManagerPlugin = require('filemanager-webpack-plugin');
1+
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
2+
import FileManagerPlugin from 'filemanager-webpack-plugin';
33

4-
const PATH = require('path');
4+
export const loaderOneOf = [
5+
require.resolve('@kkt/loader-less')
6+
];
57

6-
module.exports = {
7-
plugins: [
8-
require.resolve('@kkt/plugin-less'),
9-
],
10-
// Modify the webpack config
11-
config: (conf, { dev, env, ...other }, webpack) => {
12-
conf = {
13-
...conf,
14-
mode: env === 'prod' ? 'production' : 'development',
15-
devtool: 'source-map',
16-
entry: other.appIndex,
17-
output: {
18-
filename: 'js/[hash:8].[name].js',
19-
path: PATH.join(__dirname, 'oscnews'),
20-
},
21-
plugins: [
22-
...conf.plugins.filter(item => item.constructor && item.constructor.name !== 'HotModuleReplacementPlugin'),
23-
new CleanWebpackPlugin(['oscnews'], {
24-
root: process.cwd(),
25-
}),
26-
new FileManagerPlugin({
27-
onEnd: [{
28-
copy: [
29-
{ source: './chrome-main/manifest.json', destination: './oscnews/manifest.json' },
30-
{ source: './chrome-main/background.js', destination: './oscnews/background.js' },
31-
{ source: './chrome-main/osc-logo.png', destination: './oscnews/osc-logo.png' },
32-
{ source: './src/dev-site/public/icons', destination: './oscnews/icons' },
33-
],
34-
}],
35-
}),
36-
]
8+
export default (conf) => {
9+
conf.output.publicPath = './';
10+
const regexp = /(HotModuleReplacementPlugin)/;
11+
conf.plugins = conf.plugins.map((item) => {
12+
if (item.constructor && item.constructor.name && regexp.test(item.constructor.name)) {
13+
return null;
3714
}
15+
return item;
16+
}).filter(Boolean);
3817

39-
conf = {
40-
...conf,
41-
optimization: {
42-
...conf.optimization,
43-
// https://webpack.js.org/plugins/split-chunks-plugin/
44-
// splitChunks: {
45-
// }
46-
}
47-
};
48-
49-
if (env === 'prod') {
50-
// conf = {
51-
// ...conf,
52-
// optimization: {
53-
// ...conf.optimization,
54-
// // https://webpack.js.org/plugins/split-chunks-plugin/
55-
// splitChunks: {
56-
// }
57-
// }
58-
// };
59-
}
60-
return conf;
61-
},
62-
};
18+
conf.plugins.push(new CleanWebpackPlugin({
19+
cleanStaleWebpackAssets: true
20+
}));
21+
conf.plugins.push(new FileManagerPlugin({
22+
onEnd: [{
23+
copy: [
24+
{ source: './chrome-main/manifest.json', destination: './build/manifest.json' },
25+
{ source: './chrome-main/background.js', destination: './build/background.js' },
26+
{ source: './chrome-main/osc-logo.png', destination: './build/osc-logo.png' },
27+
{ source: './src/dev-site/public/icons', destination: './build/icons' },
28+
],
29+
}],
30+
}));
31+
return conf;
32+
}

0 commit comments

Comments
 (0)