1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- const path = require("path");
- const webpack = require("webpack");
- function resolve(dir) {
- return path.join(__dirname, dir);
- }
- let timeStamp = new Date().getTime();
- // 添加historyApiFallback配置后可能会导致的内存溢出异常添加默认配置可避免
- require('events').EventEmitter.defaultMaxListeners = 0;
- // vue.config.js
- module.exports = {
- publicPath: "./",
- filenameHashing: false,
- // 打包配置
- configureWebpack: {
- output: {
- // 输出重构 打包编译后的js文件名称,添加时间戳.
- filename: `js/js[name].${timeStamp}.js`,
- chunkFilename: `js/chunk.[id].${timeStamp}.js`,
- },
- },
- css: {
- extract: {
- // 打包后css文件名称添加时间戳
- filename: `css/[name].${timeStamp}.css`,
- chunkFilename: `css/chunk.[id].${timeStamp}.css`,
- },
- },
- chainWebpack: (config) => {
- config.resolve.alias
- .set("@$", resolve("src"))
- .set("@static", resolve("public/static"));
- },
- devServer: {
- // https: true,
- port: 2024,
- // 路由模式为history时出现的404异常,需要添加配置
- historyApiFallback: {
- index: '/index.html'
- },
- proxy: {
- "/proxy_searchByName": {
- target: "http://121.43.55.7:10011/proxy",
- changeOrigin: true, // 允许跨域
- pathRewrite: {
- "^/proxy_searchByName": "/searchByName",
- },
- },
- "/oauth": {
- target: "http://121.43.55.7:2100",
- changeOrigin: true, // 允许跨域
- pathRewrite: {
- "^/oauth": "/proxy_oauth",
- },
- },
- "/dms": {
- target: "http://121.43.55.7:2101",
- changeOrigin: true, // 允许跨域
- pathRewrite: {
- "^/dms": "/proxy_dms",
- },
- },
- },
- },
- };
|