-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
87 lines (82 loc) · 2.15 KB
/
webpack.config.js
File metadata and controls
87 lines (82 loc) · 2.15 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin');
const url = require('url')
// const __filename = url.fileURLToPath(import.meta.url);
// const __dirname = path.dirname(__filename);
const entry = path.join(__dirname, "src", "index.ts");
const outputPath = path.join(__dirname, "./dist");
function makePattern(fileName) {
return [
{
from: path.join(
__dirname,
"emscripten-build",
"pipelines",
fileName,
`${fileName}.js`
),
to: path.join(__dirname, "dist", "itk", "pipeline", `${fileName}.js`),
},
{
from: path.join(
__dirname,
"emscripten-build",
"pipelines",
fileName,
`${fileName}.wasm`
),
to: path.join(__dirname, "dist", "itk", "pipeline", `${fileName}.wasm`),
},
];
}
module.exports = {
entry,
output: {
path: outputPath,
filename: "index.js",
library: {
type: "umd",
name: "bundle",
},
},
module: {
rules: [
{ test: /\.js$/, loader: "babel-loader" },
{ test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ },
],
},
plugins: [
new CopyPlugin({
patterns: [
{
from: path.join(
__dirname,
"node_modules",
"itk-wasm",
"dist",
"web-workers"
),
to: path.join(__dirname, "dist", "itk", "web-workers"),
},
...makePattern("convertToPolyData"),
...makePattern("convertEnsightToPolyData"),
...makePattern("convertUGToPolyData"),
{
from: path.join(__dirname, 'node_modules', 'itk-mesh-io'),
to: path.join(__dirname, 'dist', 'itk', 'mesh-io')
}
],
}),
],
resolve: {
fallback: { fs: false, path: false, url: false, module: false },
alias: {
'../itkConfig.js': path.resolve(__dirname, 'itkConfig.js'),
'../../itkConfig.js': path.resolve(__dirname, 'itkConfig.js'),
},
extensions: ['.tsx', '.ts', '.js'],
},
performance: {
maxAssetSize: 10000000,
},
}