Skip to content

Commit

Permalink
chore(deps): Update kkt monorepo to v5.10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 30, 2020
1 parent c34ce6e commit 16ffa88
Show file tree
Hide file tree
Showing 3 changed files with 14,842 additions and 8,746 deletions.
86 changes: 28 additions & 58 deletions .kktrc.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,32 @@
const CleanWebpackPlugin = require('clean-webpack-plugin');
const FileManagerPlugin = require('filemanager-webpack-plugin');
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import FileManagerPlugin from 'filemanager-webpack-plugin';

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

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' },
],
}],
}),
]
export default (conf) => {
conf.output.publicPath = './';
const regexp = /(HotModuleReplacementPlugin)/;
conf.plugins = conf.plugins.map((item) => {
if (item.constructor && item.constructor.name && regexp.test(item.constructor.name)) {
return null;
}
return item;
}).filter(Boolean);

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;
},
};
conf.plugins.push(new CleanWebpackPlugin({
cleanStaleWebpackAssets: true
}));
conf.plugins.push(new FileManagerPlugin({
onEnd: [{
copy: [
{ source: './chrome-main/manifest.json', destination: './build/manifest.json' },
{ source: './chrome-main/background.js', destination: './build/background.js' },
{ source: './chrome-main/osc-logo.png', destination: './build/osc-logo.png' },
{ source: './src/dev-site/public/icons', destination: './build/icons' },
],
}],
}));
return conf;
}
Loading

0 comments on commit 16ffa88

Please sign in to comment.