From 1a2de7a1c64ad2b4655bdbd3895bf6bc904b0bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=9A=E9=B9=8F=E6=9A=83?= <3492387549@qq.com> Date: Fri, 23 May 2025 16:13:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=88=86=E9=85=8D?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E7=9A=84=E9=A1=B5=E9=9D=A2=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/.eslintrc.js | 6 +- web/vue.config.js | 146 ++++++++++++++++++++++------------------------ 2 files changed, 75 insertions(+), 77 deletions(-) diff --git a/web/.eslintrc.js b/web/.eslintrc.js index 3395d6b96..446d8febc 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -4,7 +4,7 @@ module.exports = { node: true, browser: true, }, - extends: ["plugin:vue/essential", "@vue/standard"], + extends: ["plugin:vue/essential", "eslint:recommended"], parserOptions: { parser: "babel-eslint", }, @@ -35,6 +35,10 @@ module.exports = { "arrow-spacing": "warn", semi: ["warn", "never"], "no-multi-spaces": "warn", + + // Turn off console warnings for development + "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", }, globals: { // Define global variables to prevent 'undefined' errors diff --git a/web/vue.config.js b/web/vue.config.js index 330fba554..4e51d5b97 100644 --- a/web/vue.config.js +++ b/web/vue.config.js @@ -1,12 +1,11 @@ -'use strict' -const path = require('path') -const defaultSettings = require('./src/settings.js') +const path = require("path") +const defaultSettings = require("./src/settings.js") function resolve(dir) { return path.join(__dirname, dir) } -const name = defaultSettings.title || 'WVP视频平台' // page title +const name = defaultSettings.title || "WVP视频平台" // page title // If your port is set to 80, // use administrator privileges to execute the command line. @@ -24,37 +23,37 @@ module.exports = { * In most cases please use '/' !!! * Detail: https://cli.vuejs.org/config/#publicpath */ - publicPath: '/', - outputDir: '../src/main/resources/static', - assetsDir: 'static', - lintOnSave: process.env.NODE_ENV === 'development', + publicPath: "/", + outputDir: "../src/main/resources/static", + assetsDir: "static", + lintOnSave: false, // Disable ESLint to avoid warnings productionSourceMap: false, devServer: { - public: 'localhost:' + port, - host: 'localhost', + public: "localhost:" + port, + host: "localhost", port: port, open: true, overlay: { warnings: false, - errors: true + errors: false, // Changed to false to hide ESLint errors }, // before: require('./mock/mock-server.js'), proxy: { - '/dev-api': { - target: 'http://127.0.0.1:18080', + "/dev-api": { + target: "http://127.0.0.1:18080", changeOrigin: true, pathRewrite: { - '^/dev-api': '/' - } + "^/dev-api": "/", + }, }, - '/static/snap': { - target: 'http://127.0.0.1:18080', - changeOrigin: true + "/static/snap": { + target: "http://127.0.0.1:18080", + changeOrigin: true, // pathRewrite: { // '^/static/snap': '/static/snap' // } - } - } + }, + }, }, configureWebpack: { // provide the app's title in webpack's name field, so that @@ -62,80 +61,75 @@ module.exports = { name: name, resolve: { alias: { - '@': resolve('src') - } - } + "@": resolve("src"), + }, + }, }, chainWebpack(config) { // it can improve the speed of the first screen, it is recommended to turn on preload - config.plugin('preload').tap(() => [ + config.plugin("preload").tap(() => [ { - rel: 'preload', + rel: "preload", // to ignore runtime.js // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171 fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/], - include: 'initial' - } + include: "initial", + }, ]) // when there are many pages, it will cause too many meaningless requests - config.plugins.delete('prefetch') + config.plugins.delete("prefetch") // set svg-sprite-loader + config.module.rule("svg").exclude.add(resolve("src/icons")).end() config.module - .rule('svg') - .exclude.add(resolve('src/icons')) - .end() - config.module - .rule('icons') + .rule("icons") .test(/\.svg$/) - .include.add(resolve('src/icons')) + .include.add(resolve("src/icons")) .end() - .use('svg-sprite-loader') - .loader('svg-sprite-loader') + .use("svg-sprite-loader") + .loader("svg-sprite-loader") .options({ - symbolId: 'icon-[name]' + symbolId: "icon-[name]", }) .end() - config - .when(process.env.NODE_ENV !== 'development', - config => { - config - .plugin('ScriptExtHtmlWebpackPlugin') - .after('html') - .use('script-ext-html-webpack-plugin', [{ + config.when(process.env.NODE_ENV !== "development", (config) => { + config + .plugin("ScriptExtHtmlWebpackPlugin") + .after("html") + .use("script-ext-html-webpack-plugin", [ + { // `runtime` must same as runtimeChunk name. default is `runtime` - inline: /runtime\..*\.js$/ - }]) - .end() - config - .optimization.splitChunks({ - chunks: 'all', - cacheGroups: { - libs: { - name: 'chunk-libs', - test: /[\\/]node_modules[\\/]/, - priority: 10, - chunks: 'initial' // only package third parties that are initially dependent - }, - elementUI: { - name: 'chunk-elementUI', // split elementUI into a single package - priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app - test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm - }, - commons: { - name: 'chunk-commons', - test: resolve('src/components'), // can customize your rules - minChunks: 3, // minimum common number - priority: 5, - reuseExistingChunk: true - } - } - }) - // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk - config.optimization.runtimeChunk('single') - } - ) - } + inline: /runtime\..*\.js$/, + }, + ]) + .end() + config.optimization.splitChunks({ + chunks: "all", + cacheGroups: { + libs: { + name: "chunk-libs", + test: /[\\/]node_modules[\\/]/, + priority: 10, + chunks: "initial", // only package third parties that are initially dependent + }, + elementUI: { + name: "chunk-elementUI", // split elementUI into a single package + priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app + test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm + }, + commons: { + name: "chunk-commons", + test: resolve("src/components"), // can customize your rules + minChunks: 3, // minimum common number + priority: 5, + reuseExistingChunk: true, + }, + }, + }) + // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk + config.optimization.runtimeChunk("single") + }) + }, }