+
{{ item.ClinicalDataSetName }}
diff --git a/vue.config.js b/vue.config.js
index 90d68cdd..b83965cb 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,22 +1,21 @@
'use strict'
-const path = require('path')
-// eslint-disable-next-line no-undef
-const defaultSettings = require('./src/settings.js')
-const CopyPlugin = require('copy-webpack-plugin')
+const { defineConfig } = require('@vue/cli-service')
+const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const WebpackAliyunOss = require('webpack-aliyun-oss')
+const MiniCssExtractPlugin = require('mini-css-extract-plugin')
+const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
+// const TerserWebpackPlugin = require('terser-webpack-plugin')
+const { resolve } = require('path')
+const webpack = require('webpack')
+const defaultSettings = require('./src/settings.js')
const moment = require('moment')
var distDate = moment(new Date()).format('YYYY-MM-DD')
-function resolve(dir) {
- // eslint-disable-next-line no-undef
- return path.join(__dirname, dir)
-}
-
const name = process.env.NODE_ENV === 'usa' ? 'LILI' : defaultSettings.title || 'IRCIS' // page title
// eslint-disable-next-line no-undef
-module.exports = {
+module.exports = defineConfig({
// lintOnSave: false,
- transpileDependencies: ['@cornerstonejs', 'minio', '@aws-sdk', '@smithy'],
+ transpileDependencies: false,
publicPath: process.env.NODE_ENV === 'development' || process.env.VUE_APP_OSS_CONFIG_BUCKET === 'zyypacs-usa' ? process.env.VUE_APP_BASE_PATH : `${process.env.VUE_FILE_PATH}${process.env.VUE_APP_OSS_PATH}${distDate}/`,
// publicPath: '/',
outputDir: 'dist',
@@ -29,19 +28,15 @@ module.exports = {
'Cross-Origin-Embedder-Policy': 'require-corp'
},
// open: true,
- overlay: {
- warnings: false,
- errors: true
+ client: {
+ overlay: {
+ warnings: true,
+ errors: true
+ }
},
proxy: {
'/UploadHub': {
- // target: 'http://44.218.11.19:30000', //美国服务器
- // target: 'http://123.56.181.144:8001', // 国内生产环境
- // target: 'http://123.56.181.144:8060/api', // 国内测试环境1
- // target: 'http://123.56.181.144:8000/api', // 国内测试环境
- // target: 'http://123.56.94.154:8079', // 国内测试环境2
target: 'http://123.56.94.154:7000', // 国内测试环境2
- // target: 'http://123.56.181.144:7000',
changeOrigin: true,
secure: false,
pathRewrite: {
@@ -50,23 +45,12 @@ module.exports = {
},
'/IRaCISData': {
target: 'http://123.56.94.154:8060/', // 国内测试环境2
- // target: 'http://123.56.181.144:7000',
changeOrigin: true,
pathRewrite: {
}
},
'/api': {
- // target: 'http://44.218.11.19:30000', //美国服务器
- // target: 'http://123.56.181.144:8001', // 国内生产环境
- // target: 'http://123.56.181.144:8060/api', // 国内测试环境1
- // target: 'http://123.56.181.144:8000/api', // 国内测试环境
- // target: 'http://123.56.94.154:8079', // 国内测试环境2
- // target: 'http://123.56.94.154:7000', // 国内测试环境2
- // target: 'http://123.56.94.154:30668',
target: 'http://106.14.89.110:30000',
- //target: 'http://localhost:3305', // 后端测试环境
- // target: 'http://47.117.164.182:7010', // uat
- // target: 'http://123.56.181.144:7000',
changeOrigin: true,
secure: false,
pathRewrite: {
@@ -78,25 +62,35 @@ module.exports = {
configureWebpack: {
name: name,
output: {
- filename: `static/js/[name].[hash].js`,
- chunkFilename: `static/js/[name].[hash].js`
+ filename: `static/js/[name].[contenthash:8].js`,
+ chunkFilename: `static/js/[name].[chunkhash:8].js`,
+ assetModuleFilename: 'static/wasm/[name].[chunkhash:8][ext]'
+ },
+ resolve: {
+ fallback: {
+ 'path': require.resolve('path-browserify')
+ },
+ alias: {
+ '@': resolve('src'),
+ 'modules': resolve('node_modules'),
+ 'utils': resolve('src/utils')
+ }
+ },
+
+ experiments: {
+ // 基于异步模块的 WebAssembly 实验性特性
+ // syncWebAssembly: true,
+ asyncWebAssembly: true
},
plugins: [
- new CopyPlugin([
- // { from: './node_modules/@cornerstonejs/codec-charls/dist/charlsjs.js', to: 'charlsjs.js' },
- // { from: './node_modules/@cornerstonejs/codec-charls/dist/charlsjs.js.mem', to: './static/js/charlsjs.js.mem' },
- // { from: './node_modules/@cornerstonejs/codec-charls/dist/charlswasm.js', to: './static/js/charlswasm.js' },
- // { from: './node_modules/@cornerstonejs/codec-charls/dist/charlswasm.wasm', to: './static/js/charlswasm.wasm' },
- // { from: './node_modules/@ffmpeg/core/dist/ffmpeg-core.js', to: 'ffmpeg-core.js' },
- // { from: './node_modules/@ffmpeg/core/dist/ffmpeg-core.wasm', to: 'ffmpeg-core.wasm' },
- // { from: './node_modules/@ffmpeg/core/dist/ffmpeg-core.worker.js', to: 'ffmpeg-core.worker.js' },
- {
- from: path.resolve(__dirname, './static'),
- to: path.resolve(__dirname, './dist/static'),
- ignore: ['.*']
- }
- ]),
- process.env.NODE_ENV === 'development' || process.env.VUE_APP_OSS_CONFIG_BUCKET === 'zyypacs-usa' ? function () { }
+ new MiniCssExtractPlugin({
+ filename: 'static/css/[name].[contenthash:8].css'
+ }),
+ new NodePolyfillPlugin(),
+ new webpack.ProvidePlugin({
+ process: 'process/browser'
+ }),
+ process.env.NODE_ENV === 'development' || process.env.VUE_APP_OSS_CONFIG_BUCKET === 'zyypacs-usa' ? function() { }
: new WebpackAliyunOss({
from: ['./dist/**'],
dist: process.env.VUE_APP_OSS_PATH + distDate,
@@ -118,79 +112,72 @@ module.exports = {
})
// new OfflinePlugin({})
],
+ // 如果需要对 .wasm 文件进行特殊处理,可以添加 module.rules 配置
+ module: {
+ rules: [
+ {
+ test: /\.wasm$/,
+ type: 'asset/resource'
+ }
+ ]
+ },
+ optimization: {
+ splitChunks: {
+ chunks: 'all',
+ cacheGroups: {
+ libs: { // 第三方库
+ name: 'chunk-libs',
+ test: /[\V/]node_modules[\\/]/,
+ priority: 10,
+ chunks: 'initial' // 只打包初始时依赖的第三方
+ },
+ elementUI: { // elementuI 单独拆包
+ name: 'chunk-elementUI',
+ test: /[\V/]node_modules[\V]element-ui[\/]/,
+ priority: 20 // 权重要大于 libs
+ },
+ commons: { // 公共模块包
+ name: `chunk-commons`,
+ test: /[\\/]src[\\/]/, // can customize your rules
+ minSize: 1024,
+ chunks: 'initial',
+ priority: 5
+ },
+ default: {
+ minChunks: 2,
+ priority: -20,
+ reuseExistingChunk: true
+ }
+ }
+ },
+ minimize: true,
+ minimizer: [
+ // 配置生产环境的压缩方案:js和css
+ // new TerserWebpackPlugin({
+ // // 开启多进程打包
+ // parallel: true
+ // }),
+ new CssMinimizerPlugin()
+ ]
+ },
performance: {
- hints: 'warning',
+ hints: false,
// 入口起点的最大体积
maxEntrypointSize: 5000000000,
// 生成文件的最大体积
maxAssetSize: 3000000000,
// 只给出js的性能提示
- assetFilter: function (assetFileName) {
+ assetFilter: function(assetFileName) {
return assetFileName.endsWith('.js')
}
- },
-
- resolve: {
- alias: {
- // src/@cornerstonejs/dicom-image-loader/dist/dynamic-import/cornerstoneDICOMImageLoader.min.js
- '@': resolve('src'),
- 'modules': resolve('node_modules'),
- 'utils': resolve('src/utils')
- // '@cornerstonejs/dicom-image-loader': 'src/@cornerstonejs/dicom-image-loader',
- // '@cornerstonejs/calculate-suv': 'src/@cornerstonejs/calculate-suv',
- // '@cornerstonejs/core': 'src/@cornerstonejs/core',
- // '@cornerstonejs/streaming-image-volume-loader': 'src/@cornerstonejs/streaming-image-volume-loader',
- // '@cornerstonejs/tools': 'src/@cornerstonejs/tools',
- // '@cornerstonejs/dicom-codec': 'src/@cornerstonejs/dicom-codec',
- // '@cornerstonejs/codec-charls': 'src/@cornerstonejs/codec-charls'
- // '@cornerstonejs/dicom-image-loader': resolve('src/@cornerstonejs/dicom-image-loader'),
- // '@cornerstonejs/calculate-suv': resolve('src/@cornerstonejs/calculate-suv'),
- // '@cornerstonejs/core': resolve('src/@cornerstonejs/core'),
- // '@cornerstonejs/streaming-image-volume-loader': resolve('src/@cornerstonejs/streaming-image-volume-loader'),
- // '@cornerstonejs/tools': resolve('src/@cornerstonejs/tools'),
- // '@cornerstonejs/dicom-codec': resolve('src/@cornerstonejs/dicom-codec'),
- // '@cornerstonejs/codec-charls': resolve('src/@cornerstonejs/codec-charls')
- // 'cornerstone-wado-image-loader': resolve('src/@cornerstonejs/dicom-image-loader/dist/dynamic-import/cornerstoneDICOMImageLoader.min.js')
- }
}
-
},
- chainWebpack(config) {
- config.plugins.delete('preload') // TODO: need test
- config.plugins.delete('prefetch') // TODO: need test
- // set svg-sprite-loader
- // config.optimization.splitChunks({
- // chunks: "initial", //async异步代码分割 initial同步代码分割 all同步异步分割都开启
- // minSize: 30000, //字节 引入的文件大于30kb才进行分割
- // //maxSize: 50000, //50kb,尝试将大于50kb的文件拆分成n个50kb的文件
- // minChunks: 1, //模块至少使用次数
- // maxAsyncRequests: 5, //同时加载的模块数量最多是5个,只分割出同时引入的前5个文件
- // maxInitialRequests: 3, //首页加载的时候引入的文件最多3个
- // automaticNameDelimiter: '~', //缓存组和生成文件名称之间的连接符
- // name: true, //缓存组里面的filename生效,覆盖默认命名
- // cacheGroups: { //缓存组,将所有加载模块放在缓存里面一起分割打包
- // vendors: { //自定义打包模块
- // test: /[\\/]node_modules[\\/]/,
- // priority: -10, //优先级,先打包到哪个组里面,值越大,优先级越高
- // filename: 'vendors.js',
- // },
- // default: { //默认打包模块
- // priority: -20,
- // reuseExistingChunk: true, //模块嵌套引入时,判断是否复用已经被打包的模块
- // filename: 'common.js'
- // }
- // }
- // })
- config.module
- .rule('svg')
- .exclude.add(resolve('src/icons'))
- .add(resolve('src/assets/icons'))
- .end()
+ chainWebpack: (config) => {
+ config.module.rule('svg').exclude.add(resolve('src/icons')).end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
- .add(resolve('src/assets/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
@@ -198,29 +185,5 @@ module.exports = {
symbolId: 'icon-[name]'
})
.end()
-
- // set preserveWhitespace
- config.module
- .rule('vue')
- .use('vue-loader')
- .loader('vue-loader')
- .tap(options => {
- options.compilerOptions.preserveWhitespace = true
- return options
- })
- .end()
-
- // config.module
- // .rule('js')
- // .test(/\.js$/)
- // .exclude.add(resolve('node_modules'))
- // .add(resolve('src'))
- // .end()
- // .use('babel-loader')
- // .loader('babel-loader')
- // .options({
- // presets: ['@babel/preset-env']
- // })
- // .end()
}
-}
+})