Skip to content

Commit

Permalink
chore(deps): update dependency kkt to v7.
Browse files Browse the repository at this point in the history
Upgrade react-scripts to v5, Support Webpack 5.x
kktjs/kkt#198
  • Loading branch information
jaywcjlove committed Jan 10, 2022
1 parent c0e9c17 commit e230aa0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 112 deletions.
33 changes: 31 additions & 2 deletions .kktrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import rawModules from '@kkt/raw-modules';
import scopePluginOptions from '@kkt/scope-plugin-options';
import pkg from './package.json';

export default (conf: Configuration, env: string, options: LoaderConfOptions) => {
export default (conf: Configuration, env: 'production' | 'development', options: LoaderConfOptions) => {
conf = rawModules(conf, env, { ...options });
conf = lessModules(conf, env, options);
conf = scopePluginOptions(conf, env, {
Expand All @@ -19,6 +19,35 @@ export default (conf: Configuration, env: string, options: LoaderConfOptions) =>
conf.plugins!.push(new webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version),
}));
conf.output = { ...conf.output, publicPath: './' }
if (env === 'production') {
conf.output = { ...conf.output, publicPath: './' }
conf.optimization = {
...conf.optimization,
splitChunks: {
cacheGroups: {
reactvendor: {
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
name: 'react-vendor',
chunks: 'all',
},
refractor: {
test: /[\\/]node_modules[\\/](refractor)[\\/]/,
name: 'refractor-prismjs-vendor',
chunks: 'all',
},
runtime: {
test: /[\\/]node_modules[\\/](@babel)[\\/]/,
name: 'babel-vendor',
chunks: 'all',
},
parse5: {
test: /[\\/]node_modules[\\/](parse5)[\\/]/,
name: 'parse5-vendor',
chunks: 'all',
},
}
}
}
}
return conf;
}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"noEmit": true
},
"include": [
"website"
"website",
".kktrc.ts"
]
}
109 changes: 0 additions & 109 deletions website/example.json

This file was deleted.

0 comments on commit e230aa0

Please sign in to comment.