101 lines
2.9 KiB
JavaScript
101 lines
2.9 KiB
JavaScript
'use strict'
|
|
const path = require('path')
|
|
const {name} = require("./package.json")
|
|
// const port = process.env.port || process.env.npm_config_port || 9527 // dev port
|
|
const port = 9527 // dev port
|
|
const publicPath = process.env.NODE_ENV === 'production' ? "http://" + process.env.VUE_APP_HOST : '/';
|
|
console.log(port)
|
|
module.exports = {
|
|
publicPath: '/',
|
|
// port:9527,
|
|
outputDir: 'dist',
|
|
assetsDir: 'static',
|
|
lintOnSave: process.env.NODE_ENV === 'development',
|
|
|
|
productionSourceMap: false,
|
|
devServer: {
|
|
headers:{
|
|
"Access-Control-Allow-Origin":"*"
|
|
},
|
|
port: port,
|
|
open: true,
|
|
overlay: {
|
|
warnings: false,
|
|
errors: true
|
|
},
|
|
// before: require('./mock/mock-server.js'),
|
|
proxy: {
|
|
"/mock": {
|
|
target: "http:/127.0.0.1:8888/",
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
// "^/mock": "/mock"
|
|
}
|
|
},
|
|
// 接口代理配置
|
|
'/workbench': {
|
|
target: 'http://121.43.42.180:13777/',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/workbench/, '/api')
|
|
},
|
|
// 静态文件代理配置
|
|
'/base': {
|
|
target: 'http://127.0.0.1:3000/',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/base/, '/base')
|
|
}
|
|
}
|
|
},
|
|
css: {
|
|
sourceMap: true
|
|
},
|
|
configureWebpack:{
|
|
output:{
|
|
library:`${name}-[name]`,
|
|
libraryTarget:"umd",
|
|
jsonpFunction: `webpackJsonp_${name}`
|
|
}
|
|
},
|
|
transpileDependencies: ['common'],
|
|
chainWebpack: config => {
|
|
config.plugin('html')
|
|
.tap((args) => {
|
|
args[0].title = 'qiankun-example'
|
|
return args
|
|
})
|
|
const fontRule = config.module.rule('fonts')
|
|
fontRule.uses.clear()
|
|
fontRule
|
|
.use('file-loader')
|
|
.loader('file-loader')
|
|
.options({
|
|
name: 'dist/fonts/[name].[hash:7].[ext]',
|
|
publicPath,
|
|
})
|
|
.end()
|
|
config.module
|
|
.rule("svg")
|
|
.exclude.add(path.join(__dirname,"src/asset/icons/svg"))
|
|
.end()
|
|
.use('svg-sprite')
|
|
.loader("svg-sprite-loader")
|
|
.options({
|
|
symbolId:"icon-[name]"
|
|
})
|
|
.end()
|
|
// config.module
|
|
// .rule("fonts")
|
|
// .test(/.(ttf|otf|eot|woff|woff2)$/)
|
|
// .use("url-loader")
|
|
// .loader("url-loader")
|
|
// .tap(options => {
|
|
// options = {
|
|
// // limit: 10000,
|
|
// name: '/static/fonts/[name].[ext]',
|
|
// }
|
|
// return options
|
|
// })
|
|
// .end()
|
|
}
|
|
}
|