-
Notifications
You must be signed in to change notification settings - Fork 20
/
vue.config.js
73 lines (67 loc) · 1.94 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// See below about ITK loading
// const path = require("path");
// const CopyPlugin = require("copy-webpack-plugin");
const vtkRegex = /\b(vtk.js)/
const plugins = []
const externals = [
{
"cornerstone-core": {
commonjs: "cornerstone-core",
commonjs2: "cornerstone-core",
amd: "cornerstone-core",
root: "cornerstone"
}
}
]
if(process.env.NODE_ENV === "production") {
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
plugins.push(new BundleAnalyzerPlugin())
externals.push(vtkRegex)
}
//prettier-ignore
module.exports = {
configureWebpack: {
plugins,
},
chainWebpack: config => {
config.externals(externals);
// Shader Loader
config.module
.rule("shaderloader")
.include.add(/vtk\.js[\/\\]Sources/).end()
.test(/\.glsl$/)
.use("shader-loader")
.loader("shader-loader")
.end();
// Webworker loader
config.module
.rule("webworker")
.include.add(/vtk\.js[\/\\]Sources/).end()
.test(/\.worker\.js$/)
.use("worker-loader")
.loader("worker-loader")
.options({
inline: true,
fallback: false,
})
.end();
// Only if we want to copy the ITK modules for direct manipulation of Dicom files
// config.plugin('clean')
// .use(CopyPlugin,[ [
// {
// from: path.join(__dirname, 'node_modules', 'itk', 'WebWorkers'),
// to: path.join(__dirname, 'dist', 'itk', 'WebWorkers'),
// },
// {
// from: path.join(__dirname, 'node_modules', 'itk', 'ImageIOs'),
// to: path.join(__dirname, 'dist', 'itk', 'ImageIOs'),
// },
// {
// from: path.join(__dirname, 'node_modules', 'itk', 'MeshIOs'),
// to: path.join(__dirname, 'dist', 'itk', 'MeshIOs'),
// },
// ]]);
},
css: { extract: false }
};