mirror of
https://github.com/jaywcjlove/wxmp.git
synced 2026-01-11 07:48:48 +08:00
feat: init web app.
This commit is contained in:
50
.kktrc.ts
Normal file
50
.kktrc.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import path from 'path';
|
||||
import webpack, { Configuration } from 'webpack';
|
||||
import lessModules from '@kkt/less-modules';
|
||||
import { mdCodeModulesLoader } from 'markdown-react-code-preview-loader';
|
||||
import scopePluginOptions from '@kkt/scope-plugin-options';
|
||||
import { LoaderConfOptions } from 'kkt';
|
||||
import raw from '@kkt/raw-modules';
|
||||
import pkg from './package.json';
|
||||
|
||||
export default (conf: Configuration, env: 'development' | 'production', options: LoaderConfOptions) => {
|
||||
conf = lessModules(conf, env, options);
|
||||
conf = mdCodeModulesLoader(conf);
|
||||
conf = raw(conf, env, {
|
||||
...options,
|
||||
test: /\.(md.css)$/i,
|
||||
});
|
||||
conf = scopePluginOptions(conf, env, {
|
||||
...options,
|
||||
allowedFiles: [path.resolve(process.cwd(), 'README.md'), path.resolve(process.cwd(), 'src')],
|
||||
});
|
||||
conf.plugins!.push(
|
||||
new webpack.DefinePlugin({
|
||||
VERSION: JSON.stringify(pkg.version),
|
||||
}),
|
||||
);
|
||||
|
||||
conf.module!.exprContextCritical = false;
|
||||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return conf;
|
||||
};
|
||||
Reference in New Issue
Block a user