Skip to content

Commit

Permalink
chore: Upgrade kkt v4.1.7 to v5.0.0-alpha.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 6, 2019
1 parent 3f9f81e commit 3e97857
Show file tree
Hide file tree
Showing 5 changed files with 3,151 additions and 1,378 deletions.
62 changes: 0 additions & 62 deletions .kktrc.js

This file was deleted.

66 changes: 66 additions & 0 deletions .kktrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import path from 'path';


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

export default (conf, options) => {
if (options.yargsArgs && options.yargsArgs.bundle) {
conf.devtool = false;
const regexp = /(HtmlWebpackPlugin|InlineChunkHtmlPlugin|InterpolateHtmlPlugin|MiniCssExtractPlugin|ManifestPlugin|GenerateSW|ForkTsCheckerWebpackPlugin)/;
conf.plugins = conf.plugins.map((item) => {
if (item.constructor && item.constructor.name && regexp.test(item.constructor.name)) {
return null;
}
return item;
}).filter(Boolean);
conf.entry = './src/index.ts';
conf.output = {
path: path.join(process.cwd(), 'dist'),
filename: 'uiw.js',
library: 'UIW',
libraryTarget: 'umd',
}
conf.externals = {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
},
}
if (options.yargsArgs && options.yargsArgs.mini) {
conf.output.filename = 'uiw.min.js';
conf.plugins = [
...conf.plugins,
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: 'uiw.min.css',
// allChunks: true because we want all css to be included in the main
// css bundle when doing code splitting to avoid FOUC:
// https://github.com/facebook/create-react-app/issues/2415
allChunks: true,
})
];
} else {
conf.optimization.minimize = false;
conf.plugins = [
...conf.plugins,
new MiniCssExtractPlugin({
filename: 'uiw.css',
allChunks: true,
})
];
}
}
return conf
}
Loading

0 comments on commit 3e97857

Please sign in to comment.