Commit d8c2ae46 by Jaxon

chron: 升级 webpack5

1 parent 1d0d0e7b
......@@ -6,7 +6,7 @@ module.exports = () => {
"autoprefixer": {
overrideBrowserslist: ["Android 4.1", "iOS 7.1", "Chrome > 31", "ff > 31", "ie >= 8"],
},
"postcss-px-to-viewport": {
"postcss-px-to-viewport-8-plugin": {
viewportWidth: 375, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportUnit: "vw", // 指定需要转换成的视窗单位,建议使用vw
......
......@@ -17,6 +17,6 @@ if (IS_PROD) {
}
module.exports = {
presets: [["@vue/cli-plugin-babel/preset", { useBuiltIns: "usage", corejs: 3 }]],
presets: [["@vue/babel-preset-app", { useBuiltIns: "usage", corejs: 3 }]],
plugins,
};
......@@ -27,24 +27,26 @@
},
"devDependencies": {
"@antfu/eslint-config": "^6.7.3",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/babel-preset-app": "^5.0.8",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-router": "~5.0.8",
"@vue/cli-plugin-vuex": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"autoprefixer": "^9.8.8",
"babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"eslint": "^9.39.2",
"eslint-plugin-format": "^1.2.0",
"less": "^4.6.4",
"less-loader": "^7.3.0",
"postcss-px-to-viewport": "^1.1.1",
"less-loader": "^11.1.4",
"postcss-px-to-viewport-8-plugin": "^1.2.5",
"sass": "^1.99.0",
"sass-loader": "^8.0.2",
"sass-loader": "^13.3.3",
"script-ext-html-webpack-plugin": "^2.1.4",
"svg-sprite-loader": "6.0.11",
"vue-loader": "^15.9.8",
"vue-loader": "15.11.1",
"vue-template-compiler": "^2.6.11",
"webpack-bundle-analyzer": "^3.8.0"
},
......
This diff could not be displayed because it is too large.
......@@ -2,6 +2,7 @@
const path = require("node:path");
const defaultSettings = require("./src/config/conf.js");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
const resolve = dir => path.join(__dirname, dir);
const iconsPath = resolve("src/assets/icons");
......@@ -37,18 +38,13 @@ module.exports = {
lintOnSave: false,
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: {
disableHostCheck: true,
port: 9527, // 端口 dj-scrm-wx-work-lwk
// port: 9528, // 端口 dj-scrm-wx-work-main-lwk
open: false, // 启动后打开浏览器.
// public: 'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main-zhangls/#/',
overlay: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false,
errors: true,
client: {
overlay: {
warnings: false,
errors: true,
},
},
port: 9527, // 端口 dj-scrm-wx-work-lwk
// proxy: {
// //配置跨域
// '/api': {
......@@ -77,7 +73,7 @@ module.exports = {
scss: {
// 向全局sass样式传入共享的全局变量, $src可以配置图片cdn前缀
// 详情: https://cli.vuejs.org/guide/css.html#passing-options-to-pre-processor-loaders
prependData: `
additionalData: `
$cdn: "${defaultSettings.cdn}";
`,
},
......@@ -88,6 +84,7 @@ module.exports = {
config.resolve.modules = ["node_modules", "./src/assets/spritesmith"];
const Plugins = [
new CaseSensitivePathsPlugin(),
new SpritesmithPlugin({
// 引入图片文件夹
src: {
......@@ -161,13 +158,18 @@ module.exports = {
// .set('plugins', resolve('src/components'))
// .set('utils', resolve('src/utils'))
/**
* 设置保留空格
* 设置保留空格 - 删除 thread-loader 避免 Vue 2.7 兼容性问题
*/
config.module
.rule("vue")
.uses
.clear()
.end()
.use("vue-loader")
.loader("vue-loader")
.tap((options) => {
options = options || {};
options.compilerOptions = options.compilerOptions || {};
options.compilerOptions.preserveWhitespace = true;
return options;
})
......@@ -184,19 +186,9 @@ module.exports = {
}
config
// https://webpack.js.org/configuration/devtool/#development
.when(!IS_PROD, config => config.devtool("cheap-source-map"));
.when(!IS_PROD, config => config.devtool("cheap-module-source-map"));
config.when(IS_PROD, (config) => {
config
.plugin("ScriptExtHtmlWebpackPlugin")
.after("html")
.use("script-ext-html-webpack-plugin", [
{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/,
},
])
.end();
config.optimization.splitChunks({
chunks: "all",
cacheGroups: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!