1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- const path = require('path')
- var webpack = require('webpack')
- const defaultSettings = require('./src/settings.js')
- const name = defaultSettings.title || 'SASS' //标题
- function resolve(dir) {
- return path.join(__dirname, dir)
- }
- module.exports = {
- //路径前缀
- publicPath: '/',
- lintOnSave: true,
- productionSourceMap: false,
- chainWebpack: (config) => {
- config.plugin('provide').use(webpack.ProvidePlugin, [
- {
- 'window.Quill': 'quill/dist/quill.js',
- Quill: 'quill/dist/quill.js',
- },
- ])
- //忽略的打包文件
- config.externals({
- vue: 'Vue',
- 'vue-router': 'VueRouter',
- vuex: 'Vuex',
- axios: 'axios',
- })
- const entry = config.entry('app')
- entry.add('babel-polyfill').end()
- entry.add('classlist-polyfill').end()
- entry.add('@/mock').end()
- config.resolve.alias
- .set('@', resolve('packages'))
- .set('@utils', resolve('packages/utils'))
- .set('@mixins', resolve('packages/mixins'))
- .set('@', resolve('src'))
- // set svg-sprite-loader
- config.module.rules.delete('svg') // 重点:删除默认配置中处理svg
- config.module
- .rule('svg-sprite-loader')
- .test(/\.svg$/)
- .include.add(resolve('src/icons')) // 处理svg目录
- .end()
- .use('svg-sprite-loader')
- .loader('svg-sprite-loader')
- .options({
- symbolId: 'icon-[name]',
- })
- },
- css: {
- extract: {
- ignoreOrder: true,
- },
- },
- //开发模式反向代理配置,生产模式请使用Nginx部署并配置反向代理
- devServer: {
- port: 1666,
- proxy: {
- [process.env.VUE_APP_BASE_API]: {
- //本地服务接口地址
- target: 'http://www.printmat.cn:8866',
- // target: 'http://116.205.162.119:8866',
- // target: 'http://192.168.1.164:8866',
- changeOrigin: true,
- pathRewrite: {
- [`^${process.env.VUE_APP_BASE_API}`]: '/',
- },
- },
- },
- },
- configureWebpack: {
- name: name,
- resolve: {
- alias: {
- '@': resolve('src'),
- },
- },
- // 解决xlxs-style报错问题
- externals: {
- './cptable': 'var cptable',
- },
- // devtool: 'source-map', // 配置本地调试
- },
- }
|