|
@@ -1,6 +1,77 @@
|
|
|
-// vue.config.js
|
|
|
-module.exports = {
|
|
|
- devServer: {
|
|
|
- progress: false
|
|
|
- }
|
|
|
- }
|
|
|
+const path = require('path')
|
|
|
+const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
|
|
+const { defineConfig } = require('@vue/cli-service')
|
|
|
+const Timestamp = new Date().getTime();
|
|
|
+function resolve(dir) {
|
|
|
+ return path.join(__dirname, './', dir)
|
|
|
+}
|
|
|
+
|
|
|
+module.exports = defineConfig({
|
|
|
+ transpileDependencies: true,
|
|
|
+ outputDir: '../wwwroot',
|
|
|
+ lintOnSave: false,
|
|
|
+ //transpileDependencies: ['@azure'],
|
|
|
+ productionSourceMap: false, // 设置上线后是否加载webpack文件
|
|
|
+ devServer: {
|
|
|
+ progress: false
|
|
|
+ },
|
|
|
+ pages: {
|
|
|
+ app: {
|
|
|
+ entry: 'src/main.js',
|
|
|
+ template: 'public/index.html',
|
|
|
+ filename: 'index.html',
|
|
|
+ // chunks: ['chunk-vendors','chunk-common','app','chunk-viewDesign','chunk-static','chunk-konva','chunk-azure','chunk-xlsx','chunk-video','chunk-pdfjs','chunk-wangeditor','chunk-h2c','chunk-corejs']
|
|
|
+ }
|
|
|
+ },
|
|
|
+ chainWebpack(config) {
|
|
|
+ // 移除prefetch插件,避免加载多余的资源
|
|
|
+ config.plugins.delete('prefetch')
|
|
|
+ // 移除 preload 插件,避免加载多余的资源
|
|
|
+ config.plugins.delete('preload');
|
|
|
+ config.module
|
|
|
+ .rule('svg')
|
|
|
+ .exclude
|
|
|
+ .add(resolve('src/icons/svg'))
|
|
|
+ .add(resolve('src/assets/student-web/icons'))
|
|
|
+ .end()
|
|
|
+ config.module
|
|
|
+ .rule('icons')
|
|
|
+ .test(/\.svg$/)
|
|
|
+ .include
|
|
|
+ .add(resolve('src/icons/svg'))
|
|
|
+ .add(resolve('src/assets/student-web/icons'))
|
|
|
+ .end()
|
|
|
+ .use('svg-sprite-loader')
|
|
|
+ .loader('svg-sprite-loader')
|
|
|
+ .options({
|
|
|
+ symbolId: 'icon-[name]'
|
|
|
+ })
|
|
|
+ .end()
|
|
|
+ },
|
|
|
+ pluginOptions: {
|
|
|
+ 'style-resources-loader': {
|
|
|
+ preProcessor: 'less',
|
|
|
+ patterns: [
|
|
|
+ // 这个是加上自己的路径,不能使用(如下:alias)中配置的别名路径
|
|
|
+ path.resolve(__dirname, './src/css/less-variable.less')
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ configureWebpack: {
|
|
|
+ plugins: [
|
|
|
+ new CleanWebpackPlugin()
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ configureWebpack: config => {
|
|
|
+ config.optimization.minimizer[0].options.terserOptions.compress.drop_console = process.env.NODE_ENV === 'production'
|
|
|
+ config.output.filename = `js/[name].${Timestamp}.js`
|
|
|
+ config.output.chunkFilename = `js/[name].${Timestamp}.js`
|
|
|
+ config.externals = {
|
|
|
+ 'vue': 'Vue',
|
|
|
+ 'vue-router': 'VueRouter',
|
|
|
+ 'view-design': 'iview'
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+})
|