Skip to content

Commit 6aa257e

Browse files
ladeirarodolfoJamesAPetts
authored andcommitted
feat: 🎸 bundle vtkjs with viewport to reduce build issues (#82)
1 parent 1f76d6d commit 6aa257e

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

‎.webpack/webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const autoprefixer = require('autoprefixer');
55
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
66
.BundleAnalyzerPlugin;
77
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
8+
const externalConfig = require('./webpack.external.config').default;
89

910
const ENTRY_VTK_EXT = path.join(__dirname, './../src/index.js');
1011
const SRC_PATH = path.join(__dirname, './../src');
@@ -33,6 +34,7 @@ module.exports = (env, argv) => {
3334
},
3435
module: {
3536
rules: [
37+
...externalConfig.moduleRules,
3638
{
3739
test: /\.(js|jsx)$/,
3840
exclude: /node_modules/,
@@ -59,7 +61,6 @@ module.exports = (env, argv) => {
5961
},
6062
externals: [
6163
// :wave:
62-
/\b(vtk.js)/,
6364
// Used to build/load metadata
6465
{
6566
'cornerstone-core': {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Configurations to support some packages with any sort of missing bundle configuration
2+
3+
// Configure vtk rules
4+
function configureVtkRules() {
5+
return [
6+
{
7+
issuer: /vtk\.js\//,
8+
test: /\.glsl$/i,
9+
loader: 'shader-loader',
10+
},
11+
{
12+
issuer: /vtk\.js\//,
13+
test: /\.css$/,
14+
exclude: /\.module\.css$/,
15+
use: [
16+
{ loader: 'style-loader' },
17+
{ loader: 'css-loader' },
18+
{ loader: 'postcss-loader' },
19+
],
20+
},
21+
{
22+
issuer: /vtk\.js\//,
23+
test: /\.module\.css$/,
24+
use: [
25+
{ loader: 'style-loader' },
26+
{
27+
loader: 'css-loader',
28+
options: {
29+
localIdentName: '[name]-[local]_[sha512:hash:base64:5]',
30+
modules: true,
31+
},
32+
},
33+
{ loader: 'postcss-loader' },
34+
],
35+
},
36+
{
37+
issuer: /vtk\.js\//,
38+
test: /\.svg$/,
39+
use: [{ loader: 'raw-loader' }],
40+
},
41+
{
42+
issuer: /vtk\.js\//,
43+
test: /\.worker\.js$/,
44+
use: [
45+
{ loader: 'worker-loader', options: { inline: true, fallback: false } },
46+
],
47+
},
48+
];
49+
}
50+
exports.default = {
51+
moduleRules: configureVtkRules(),
52+
};

0 commit comments

Comments
 (0)