123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- const webpack = require('webpack')
- const packageName = 'qmxSubApp'
- module.exports = {
- publicPath: '/qmx_page_admin',
- outputDir: "qmx_page_admin",
- productionSourceMap: false,
- lintOnSave: false,
- css: {
- loaderOptions: {
- sass: {
- // 静默 `legacy-js-api` 和 `@import` 警告
- sassOptions: {
- silenceDeprecations: ['legacy-js-api', 'import', 'global-builtin']
- },
- prependData: `@import '@/assets/css/_variables.scss';`
- }
- }
- },
- configureWebpack: {
- // devtool: 'source-map',
- output: {
- library: 'qmxSubApp',
- libraryTarget: 'umd',
- jsonpFunction: `webpackJsonp_${packageName}`
- },
- plugins: [
- new webpack.ProvidePlugin({
- $:"jquery",
- jQuery:"jquery",
- "windows.jQuery":"jquery"
- })
- ],
- optimization: {
- splitChunks: {
- chunks: 'all', // 对所有类型的chunk进行分割
- minSize: 40 * 8 * 1024, // 分割前模块的最小大小(字节)
- maxSize: 200 * 8 * 1024, // 尝试将大于此大小的块分割成较小的部分
- minChunks: 2, // 分割前模块的最小被引用次数
- maxInitialRequests: 20,// 入口点的最大并行请求数
- automaticNameDelimiter: '.', // 生成的名称分隔符
- cacheGroups: {
- // 自定义缓存组
- vendors: {
- test: /[\\/]node_modules[\\/]/,
- priority: -10,
- name: 'vendors'
- },
- default: {
- minChunks: 2,
- priority: -20,
- reuseExistingChunk: true,
- name: 'common'
- },
- }
- },
- },
- },
- chainWebpack: (config) => {
- const fontRule = config.module.rule('fonts');
- fontRule.uses.clear();
- fontRule
- .use('file-loader')
- .loader('file-loader')
- .options({
- name: 'fonts/[name].[hash:8].[ext]',
- publicPath: process.env.NODE_ENV === 'production' ? '/qmx_page_admin' : '',
- })
- .end();
- },
- devServer: {
- // open: false,
- // client: {
- // overlay: {
- // errors: true,
- // warnings: false
- // }
- // },
- // // historyApiFallback: true,
- // allowedHosts: 'all',
- proxy: {
- '^/dev-api': {
- target: 'https://web2-qmx_admin.jydev.jianyu360.com',
- changeOrigin: true,
- ws: false,
- logLevel: 'debug',
- pathRewrite: {
- '^/dev-api': '/api/admin/'
- }
- },
- '^/bigmember': {
- target: 'https://jybx2-webtest.jydev.jianyu360.com',
- changeOrigin: true,
- ws: false,
- logLevel: 'debug',
- pathRewrite: {
- '^/bigmember': '/bigmember'
- }
- },
- '^/filemanage': {
- target: 'https://web2-qmx_admin.jydev.jianyu360.com',
- changeOrigin: true,
- ws: false,
- logLevel: 'debug',
- pathRewrite: {
- '^/filemanage': '/filemanage'
- }
- },
- '^/jyOrderManager': {
- target: 'https://jybx2-webtest.jydev.jianyu360.com',
- changeOrigin: true,
- ws: false,
- logLevel: 'debug',
- },
- '^/succbi': {
- target: 'https://web2-qmx_admin.jydev.jianyu360.com',
- changeOrigin: true,
- ws: false,
- logLevel: 'debug'
- }
- }
- }
- }
|