mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
build(web): 添加 ESLint 和 Prettier 配置文件
- 新增 .eslintrc.js 文件,配置 ESLint 规则和插件 - 新增 .prettierrc.json 文件,设置 Prettier 格式化选项
This commit is contained in:
@@ -1,52 +1,53 @@
|
||||
const { defineConfig } = require("@vue/cli-service");
|
||||
const path = require("path");
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
const path = require('path')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true,
|
||||
publicPath: process.env.NODE_ENV === "production" ? "/your-project/" : "/",
|
||||
publicPath: '/',
|
||||
// 输出文件目录
|
||||
outputDir: "dist",
|
||||
outputDir: 'dist',
|
||||
|
||||
// 静态资源目录
|
||||
assetsDir: "static",
|
||||
assetsDir: 'static',
|
||||
devServer: {
|
||||
hot: true,
|
||||
compress: true,
|
||||
allowedHosts: 'all',
|
||||
headers: {
|
||||
// 1. 允许开发环境跨域
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
historyApiFallback: true,
|
||||
open: true,
|
||||
open: false,
|
||||
port: 8080,
|
||||
|
||||
client: {
|
||||
overlay: {
|
||||
runtimeErrors: (error) => {
|
||||
const ignoreErrors = [
|
||||
"ResizeObserver loop limit exceeded",
|
||||
"ResizeObserver loop completed with undelivered notifications.",
|
||||
];
|
||||
'ResizeObserver loop limit exceeded',
|
||||
'ResizeObserver loop completed with undelivered notifications.'
|
||||
]
|
||||
if (ignoreErrors.includes(error.message)) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
},
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
css: {
|
||||
loaderOptions: {
|
||||
scss: {
|
||||
additionalData: `@use "~@/style/color.scss";`,
|
||||
},
|
||||
additionalData: `@use "~@/style/color.scss";`
|
||||
}
|
||||
},
|
||||
extract: {
|
||||
filename: `css/.[contenthash:8].css`,
|
||||
chunkFilename: `css/.[contenthash:8].chunk.css`,
|
||||
},
|
||||
chunkFilename: `css/.[contenthash:8].chunk.css`
|
||||
}
|
||||
},
|
||||
// webpack相关配置
|
||||
configureWebpack: {
|
||||
// 自定义打包入口
|
||||
entry: "./src/main.js",
|
||||
|
||||
// 扩展 webpack 配置
|
||||
plugins: [
|
||||
@@ -54,13 +55,13 @@ module.exports = defineConfig({
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.join(__dirname, "src"),
|
||||
},
|
||||
},
|
||||
'@': path.join(__dirname, 'src')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码
|
||||
lintOnSave: process.env.NODE_ENV !== "production",
|
||||
lintOnSave: process.env.NODE_ENV !== 'production',
|
||||
|
||||
// 是否使用包含运行时编译器的 Vue 构建版本
|
||||
runtimeCompiler: false,
|
||||
@@ -71,5 +72,5 @@ module.exports = defineConfig({
|
||||
// 第三方插件配置
|
||||
pluginOptions: {
|
||||
// ...
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user