123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- const path = require('path');
- const Setting = require('./src/setting.env');
- const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
- const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
- const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
- const resolve = (dir) => {
- return path.join(__dirname, dir);
- };
- const BASE_URL = process.env.NODE_ENV === 'production' ? '/' : '/';
- const env = process.env.NODE_ENV;
- module.exports = {
-
-
-
-
-
-
-
- outputDir: Setting.outputDir,
- runtimeCompiler: true,
- productionSourceMap: false,
- baseUrl: BASE_URL,
-
-
-
- lintOnSave: false,
-
- configureWebpack: (config) => {
- const pluginsPro = [];
- pluginsPro.push(
-
- new UglifyJsPlugin({
- uglifyOptions: {
- compress: {
- drop_debugger: true,
- drop_console: true,
- pure_funcs: ['console.log'],
- },
- },
- sourceMap: false,
- parallel: true,
- }),
- );
- if (process.env.NODE_ENV === 'production') {
- config.plugins = [...config.plugins, ...pluginsPro];
- }
- if (process.env.NODE_ENV === 'production') {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- },
- chainWebpack: (config) => {
- config.resolve.alias
- .set('@', resolve('src'))
- .set('_c', resolve('src/components'));
-
- config.module
- .rule('vue')
- .test(/\.vue$/)
- .use('iview-loader')
- .loader('iview-loader')
- .tap(() => {
- return Setting.iviewLoaderOptions;
- })
- .end();
-
- config.resolve.alias.set('@api', resolve('src/api'));
-
- config.node.set('__dirname', true).set('__filename', true);
- config.plugin('monaco').use(new MonacoWebpackPlugin());
- },
-
- productionSourceMap: false,
-
- devServer: {
- port: 1617,
- proxy: {
-
- '/adminapi': {
-
- target: 'https://liaoningaoxun.com',
- ws: true,
- changeOrigin: true,
-
-
-
-
- },
- }
- },
- publicPath: '/admin',
- assetsDir: 'system_static',
- indexPath: 'index.html',
- };
|