加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 2.35 KB
一键复制 编辑 原始数据 按行查看 历史
liguowei 提交于 2023-11-30 16:43 . 规划样式
/**
* @Author: SYQ
* @Date: 2022-2-15 00:33:19
*/
"use strict";
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const resolve = (dir) => {
return path.resolve(__dirname, dir);
};
module.exports = {
publicPath: "./",
outputDir: "dist",
productionSourceMap: false,
lintOnSave: true,
devServer: {
open: true,
host: "0.0.0.0",
// public: "192.168.55.96:8020",
hotOnly: true,
port: 8020,
proxy: {
"/api": {
target: "http://192.168.1.208:1010",
changeOrigin: true
// pathRewrite: {
// "^/api": ""
// }
}
}
},
configureWebpack: {
externals: {
// jquery: "jQuery"
},
resolve: {
alias: {
vue$: "vue/dist/vue.esm.js",
"@": path.resolve(__dirname, "./src"),
"@xgismaps": path.resolve(__dirname, "./xgismap-sdk/dist")
},
extensions: ["*", ".js", ".vue", ".json"]
},
module: {
unknownContextCritical: false
},
performance: {
hints: false
}
},
chainWebpack: (config) => {
config.resolve.extensions
.add(".js")
.add(".vue")
.end();
config.module
.rule("images")
.test(/\.(png|jpe?g|gif)(\?.*)?$/)
.use("url-loader")
.loader("url-loader")
.options({
name: "images/[name].[ext]",
limit: 10000,
esModule: false
})
.end();
config.module
.rule("fonts")
.test(/\.(eot|ttf|TTF|woff|woff2|otf)(\?.*)?$/)
.use("url-loader")
.loader("url-loader")
.options({
name: "fonts/[name].[ext]",
limit: 10000
})
.end();
config.module
.rule("svg")
.exclude.add(resolve("src/assets/svg/icons"))
.end();
config.module
.rule("icons")
.test(/\.svg$/)
.include.add(resolve("src/assets/svg/icons"))
.end()
.use("svg-sprite-loader")
.loader("svg-sprite-loader")
.options({
symbolId: "icon-[name]"
})
.end();
config.plugin("copy").use(CopyWebpackPlugin, [
[
{
from: path.join(__dirname, "public"),
to: path.join(__dirname, "dist")
},
{
from: path.join(__dirname, "xgismap-sdk/dist/resources"),
to: path.join(__dirname, "dist", "libs/xgismaps-sdk/resources")
}
]
]);
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化