改成ES5打包
This commit is contained in:
261
package-lock.json
generated
261
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,8 @@
|
|||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/preset-env": "^7.28.3",
|
||||||
"axios": "0.21.0",
|
"axios": "0.21.0",
|
||||||
"core-js": "^3.8.3",
|
|
||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
"element-ui": "2.9.2",
|
"element-ui": "2.9.2",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
@ -25,13 +25,15 @@
|
|||||||
"vxe-table": "~3.18.9"
|
"vxe-table": "~3.18.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.12.16",
|
"@babel/core": "^7.28.4",
|
||||||
"@babel/eslint-parser": "^7.12.16",
|
"@babel/eslint-parser": "^7.12.16",
|
||||||
"@vue/cli-plugin-babel": "~5.0.0",
|
"@vue/cli-plugin-babel": "~5.0.0",
|
||||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||||
"@vue/cli-plugin-router": "~5.0.0",
|
"@vue/cli-plugin-router": "~5.0.0",
|
||||||
"@vue/cli-plugin-vuex": "~5.0.0",
|
"@vue/cli-plugin-vuex": "~5.0.0",
|
||||||
"@vue/cli-service": "~5.0.0",
|
"@vue/cli-service": "~5.0.0",
|
||||||
|
"babel-loader": "^10.0.0",
|
||||||
|
"core-js": "^3.46.0",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
|
|||||||
@ -1,46 +1,52 @@
|
|||||||
const {defineConfig} = require('@vue/cli-service')
|
const {defineConfig} = require('@vue/cli-service')
|
||||||
const postcssPxToViewport = require('postcss-px-to-viewport')
|
const postcssPxToViewport = require('postcss-px-to-viewport')
|
||||||
const path = require('path') // 需要引入 path 模块
|
const path = require('path')
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
publicPath: './',
|
publicPath: './',
|
||||||
transpileDependencies: false,
|
transpileDependencies: false, // 我们自己管,不让 CLI 插手
|
||||||
lintOnSave: false,
|
lintOnSave: false,
|
||||||
devServer: {
|
devServer: {client: {overlay: false}},
|
||||||
client: {
|
|
||||||
overlay: false,
|
configureWebpack(config) {
|
||||||
},
|
// 调试
|
||||||
},
|
|
||||||
configureWebpack: (config) => {
|
|
||||||
//调试JS
|
|
||||||
config.devtool = 'source-map'
|
config.devtool = 'source-map'
|
||||||
config.resolve = {
|
// 别名
|
||||||
alias: {
|
config.resolve.alias['@'] = path.resolve(__dirname, 'src')
|
||||||
'@': path.resolve(__dirname, 'src'),
|
|
||||||
|
/* 1. 追加 ini 规则 */
|
||||||
|
config.module.rules.push({
|
||||||
|
test: /\.ini$/,
|
||||||
|
use: 'raw-loader',
|
||||||
|
})
|
||||||
|
|
||||||
|
/* 2. 追加 ES5 规则(只转 src,不转 node_modules) */
|
||||||
|
config.module.rules.push({
|
||||||
|
test: /\.js$/,
|
||||||
|
include: path.resolve(__dirname, 'src'),
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
targets: {ie: '11'}, // 强制 ES5
|
||||||
|
corejs: 3,
|
||||||
|
useBuiltIns: 'entry',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
// 添加 .ini 文件处理规则
|
|
||||||
if (config.module && config.module.rules) {
|
|
||||||
config.module.rules.push({
|
|
||||||
test: /\.ini$/,
|
|
||||||
use: 'raw-loader'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
config.module = {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.ini$/,
|
|
||||||
use: 'raw-loader'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
css: {
|
css: {
|
||||||
|
/* 你的 px-to-viewport 配置不动 */
|
||||||
loaderOptions: {
|
loaderOptions: {
|
||||||
postcss: {
|
postcss: {
|
||||||
postcssOptions: {
|
postcssOptions: {
|
||||||
// 增加这一层 postcssOptions
|
|
||||||
plugins: [
|
plugins: [
|
||||||
postcssPxToViewport({
|
postcssPxToViewport({
|
||||||
unitToConvert: 'px',
|
unitToConvert: 'px',
|
||||||
@ -53,7 +59,7 @@ module.exports = defineConfig({
|
|||||||
minPixelValue: 1,
|
minPixelValue: 1,
|
||||||
mediaQuery: false,
|
mediaQuery: false,
|
||||||
replace: true,
|
replace: true,
|
||||||
exclude: /(\/|\\)(node_modules)(\/|\\)/,
|
exclude: /node_modules/,
|
||||||
include: [],
|
include: [],
|
||||||
landscape: false,
|
landscape: false,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user