-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): Update kkt monorepo to v5.10.3
- Loading branch information
1 parent
c34ce6e
commit 16ffa88
Showing
3 changed files
with
14,842 additions
and
8,746 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.