代码拉取完成,页面将自动刷新
同步操作将从 uiw/react-amap 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import webpack, { Configuration } from 'webpack';
import path from 'path';
import { LoaderConfOptions } from 'kkt';
import lessModules from '@kkt/less-modules';
import rawModules from '@kkt/raw-modules';
import scopePluginOptions from '@kkt/scope-plugin-options';
import pkg from './package.json';
export default (conf: Configuration, env: 'production' | 'development', options: LoaderConfOptions) => {
conf = rawModules(conf, env, options);
conf = lessModules(conf, env, options);
conf = scopePluginOptions(conf, env, {
...options,
allowedFiles: [
path.resolve(process.cwd(), 'README.md'),
path.resolve(process.cwd(), 'src'),
path.resolve(process.cwd(), 'src/Map/README.md'),
path.resolve(process.cwd(), 'src/APILoader/README.md'),
path.resolve(process.cwd(), 'src/ScaleControl/README.md'),
path.resolve(process.cwd(), 'src/ToolBarControl/README.md'),
path.resolve(process.cwd(), 'src/MapTypeControl/README.md'),
path.resolve(process.cwd(), 'src/ControlBarControl/README.md'),
path.resolve(process.cwd(), 'src/HawkEyeControl/README.md'),
path.resolve(process.cwd(), 'src/Polyline/README.md'),
path.resolve(process.cwd(), 'src/Marker/README.md'),
path.resolve(process.cwd(), 'src/Text/README.md'),
path.resolve(process.cwd(), 'src/Circle/README.md'),
path.resolve(process.cwd(), 'src/Ellipse/README.md'),
path.resolve(process.cwd(), 'src/Rectangle/README.md'),
path.resolve(process.cwd(), 'src/BezierCurve/README.md'),
path.resolve(process.cwd(), 'src/Polygon/README.md'),
path.resolve(process.cwd(), 'src/InfoWindow/README.md'),
path.resolve(process.cwd(), 'src/CircleMarker/README.md'),
path.resolve(process.cwd(), 'src/Weather/README.md'),
path.resolve(process.cwd(), 'src/Geolocation/README.md'),
path.resolve(process.cwd(), 'src/AutoComplete/README.md'),
path.resolve(process.cwd(), 'src/ContextMenu/README.md'),
],
});
// Get the project version.
conf.plugins!.push(
new webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version),
}),
);
conf.optimization = {
...conf.optimization,
splitChunks: {
chunks: 'all', // async对异步引入的代码分割 initial 对同步引入代码分割 all对同步异步引入的分割都开启
minSize: 30000, // 字节 引入的文件大于30kb才进行分割
maxSize: 0, // 文件的最大尺寸,优先级:maxInitialRequest/maxAsyncRequests < maxSize < minSize,需要注意的是这个如果配置了,umi.js 就可能被拆开,最后构建出来的 chunkMap 中可能就找不到 umi.js 了
minChunks: 1, // 模块至少使用次数
maxAsyncRequests: 30, // 同时加载的模块数量最多是_个,只分割出同时引入的前_个文件(按需加载模块)
maxInitialRequests: 25, // 首页加载的时候引入的文件最多 _ 个(加载初始页面)
automaticNameDelimiter: '~', // 缓存组和生成文件名称之间的连接符
name: true, // 缓存组里面的 filename 生效,覆盖默认命名
cacheGroups: {
markdown_preview: {
name: 'vendors-markdown-preview',
chunks: 'all',
test: /[\\/]node_modules[\\/](@uiw\/react-markdown-preview|codemirror)[\\/]/,
priority: -2,
},
prismjs: {
test: /[\\/]node_modules[\\/](prismjs)[\\/]/,
name: 'prismjs-vendor',
chunks: 'async',
},
react_code_preview: {
name: 'vendors-code-preview',
chunks: 'all',
test: /[\\/]node_modules[\\/](@uiw\/react-code-preview)[\\/]/,
priority: -2,
},
react: {
name: 'vendors-react',
chunks: 'all',
test: /[\\/]node_modules[\\/](react|react-dom|react-router-dom)[\\/]/,
priority: -5,
},
uiwjs: {
name: 'vendors-uiwjs',
chunks: 'all',
test: /[\\/]node_modules[\\/]@uiw\/(copy-to-clipboard|react-split)[\\/]/,
priority: -5,
},
lodash: {
name: 'vendors-lodash',
chunks: 'all',
test: /[\\/]node_modules[\\/](lodash)[\\/]/,
priority: -5,
},
babel_plugin: {
name: 'babel_plugin',
chunks: 'all',
// test: /[\\/]node_modules[\\/](babel-plugin-transform-remove-imports)[\\/]/,
test: /[\\/]node_modules[\\/](babel-?.*)[\\/]/,
priority: -5,
},
// babel_runtime: {
// name: 'vendors-runtime',
// chunks: 'all',
// test: /[\\/]node_modules[\\/](@babel)[\\/]/,
// priority: -5,
// },
babel_standalone: {
name: 'vendors-standalone',
chunks: 'all',
test: /[\\/]node_modules[\\/](@babel\/standalone)[\\/]/,
priority: -5,
},
babel_runtime_template: {
name: 'vendors-runtime-template',
chunks: 'all',
test: /[\\/]node_modules[\\/]@babel[\/](template|regenerator|highlight|parser|code-frame|plugin-transform-classes)[\\/]/,
priority: -5,
},
babel_runtime_core: {
name: 'vendors-runtime-core',
chunks: 'all',
test: /[\\/]node_modules[\\/](@babel\/core)[\\/]/,
priority: -5,
},
babel_runtime_generator: {
name: 'vendors-runtime-generator',
chunks: 'all',
test: /[\\/]node_modules[\\/](@babel\/generator)[\\/]/,
priority: -5,
},
babel_helper: {
name: 'vendors-helper',
chunks: 'all',
test: /[\\/]node_modules[\\/](@babel\/helper?.*)[\\/]/,
priority: -5,
},
babel_runtime_helpers: {
name: 'vendors-runtime-helpers',
chunks: 'all',
test: /[\\/]node_modules[\\/](@babel\/runtime\/helpers)[\\/]/,
priority: -5,
},
babel_runtime_types: {
name: 'vendors-runtime-types',
chunks: 'all',
test: /[\\/]node_modules[\\/](@babel\/types)[\\/]/,
priority: -5,
},
babel_runtime_traverse: {
name: 'vendors-runtime-traverse',
chunks: 'all',
test: /[\\/]node_modules[\\/](@babel\/traverse)[\\/]/,
priority: -5,
},
},
},
};
if (env === 'production') {
conf.output = { ...conf.output, publicPath: './' };
}
return conf;
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。