|
- const path = require('path');
- const defaultSettings = require('./src/config/index.js');
-
-
- const resolve = dir => path.join(__dirname, dir);
-
- const name = defaultSettings.title || 'health-student';
-
- const IS_PROD = ['production', 'test'].includes(process.env.NODE_ENV);
-
- const { defineConfig } = require('@vue/cli-service');
- module.exports = defineConfig({
- publicPath: './',
-
- outputDir: 'dist',
- lintOnSave: !IS_PROD,
- productionSourceMap: false,
- devServer: {
- port: 9093,
- open: false,
- hot: true,
- client: {
- overlay: false
- },
- proxy: {
-
-
-
-
-
-
-
-
-
-
- '/java_api': {
- target: "http://127.0.0.1:8010/",
-
- changOrigin:true,
- pathRewrite:{
- '^/java_api':'/'
- }
- }
- }
- },
- css: {
- extract: true,
- sourceMap: false,
- loaderOptions: {
- scss: {
-
-
- additionalData: `
- @import "assets/css/mixin.scss";
- @import "assets/css/variables.scss";
- `
- }
- }
- },
- configureWebpack: config => {
- config.name = name;
-
-
- },
-
- chainWebpack: config => {
-
- config.resolve.alias
- .set('@', resolve('src'))
- .set('assets', resolve('src/assets'))
- .set('api', resolve('src/api'))
- .set('views', resolve('src/views'))
- .set('components', resolve('src/components'));
-
-
- config.module
- .rule('vue')
- .use('vue-loader')
- .loader('vue-loader')
- .tap(options => {
- options.compilerOptions.preserveWhitespace = true;
- return options;
- })
- .end();
-
-
- if (IS_PROD) {
-
-
- }
- config
-
- .when(!IS_PROD, config => config.devtool('cheap-source-map'));
- config.when(IS_PROD, config => {
- config.optimization.splitChunks({
- chunks: 'all',
- cacheGroups: {
-
- commons: {
- name: 'chunk-commons',
- test: resolve('src/components'),
- minChunks: 3,
- priority: 5,
- reuseExistingChunk: true
- },
- node_vendors: {
- name: 'chunk-libs',
- chunks: 'initial',
- test: /[\\/]node_modules[\\/]/,
- priority: 10
- },
- vantUI: {
- name: 'chunk-vantUI',
- priority: 20,
- test: /[\\/]node_modules[\\/]_?vant(.*)/
- }
- }
- });
- config.optimization.runtimeChunk('single');
- });
- }
- });
|