| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- const path = require('path')
- const webpack = require('webpack')
- if (process.env.NODE_ENV === 'prod') {
- }
- const resolve = dir => {
- return path.join(__dirname, dir)
- }
- // 项目部署基础
- // 默认情况下,我们假设你的应用将被部署在域的根目录下,
- // 例如:https://www.my-app.com/
- // 默认:'/'
- // 如果您的应用程序部署在子路径中,则需要在这指定子路径
- // 例如:https://www.foobar.com/my-app/
- // 需要将它改为'/my-app/'
- // iview-admin线上演示打包路径: https://file.iviewui.com/admin-dist/
- // const BASE_URL = process.env.NODE_ENV === 'production'
- const BASE_URL = process.env.NODE_ENV === 'development'
- ? '/'
- //pad
- // : '././'
- //web
- : '/'
- module.exports = {
- // Project deployment base
- // By default we assume your app will be deployed at the root of a domain,
- // e.g. https://www.my-app.com/
- // If your app is deployed at a sub-path, you will need to specify that
- // sub-path here. For example, if your app is deployed at
- // https://www.foobar.com/my-app/
- // then change this to '/my-app/'
- // baseUrl: BASE_URL,
- publicPath: BASE_URL,
- // tweak internal webpack configuration.
- // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
- // 如果你不需要使用eslint,把lintOnSave设为false即可 es6
- lintOnSave: false,
- chainWebpack: config => {
- config.resolve.alias
- .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
- .set('_c', resolve('src/components'))
- config.plugin('provide').use(webpack.ProvidePlugin,[{
- 'window.Quill': 'quill/dist/quill.js',
- 'Quill': 'quill/dist/quill.js'
- }])
- // svg图标
- config.module.rule('svg').exclude.add(resolve('src/components/svgs')).end()
- config.module.rule('icons').test(/\.svg$/).include.add(resolve('src/components/svgs')).end()
- .use('svg-sprite-loader').loader('svg-sprite-loader').options({
- symbolId: 'icon-[name]'
- }).end()
- },
- // 设为false打包时不生成.map文件
- productionSourceMap: false,
- // 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
- devServer: {
- // proxy: 'http://127.0.0.1:8888',
- proxy: {
- '/file': {
- target: 'https://s.dev01.dkiboss.com:6010/file/', //后台服务器的ip地址
- pathRewrite: { '^/file': '/' },
- changeOrigin: true
- }
- }
- // proxyTable: {
- // '/api': {
- // target: 'http://localhost:8888',
- // changeOrigin: true,
- // pathRewrite: {
- // '^/api': ''
- // }
- // }
- // }
- },
- configureWebpack: config => {
- // 为生产环境修改配置...
- if (process.env.NODE_ENV === 'production') {
- config.mode = 'production'
- // 打包文件大小配置
- config.performance = {
- maxEntrypointSize: 10000000,
- maxAssetSize: 30000000
- }
- }
- },
- }
- //test branches
|