-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
51 lines (50 loc) · 1.37 KB
/
webpack.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
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const outputPath = 'lib';
module.exports = {
// Change to your "entry-point".
entry: {
index: __dirname + '/src/index.ts',
'libtiff-worker': __dirname + '/src/worker.ts'
},
devtool: 'source-map',
output: {
path: path.join(__dirname, outputPath),
filename: '[name].js',
library: 'libtiffjs',
libraryTarget: 'umd',
umdNamedDefine: true,
globalObject: 'this'
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
module: {
rules: [{
// Include ts, tsx, js, and jsx files.
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.wasm$/,
type: 'javascript/auto',
loader: 'file-loader',
options: {
name: '[name].[ext]',
publicPath: 'lib/',
},
}],
},
node: {
fs: 'empty'
},
plugins: [
new CopyPlugin({
patterns: [
{ from: path.join('./src', 'tiff.raw.wasm'), to: path.join(__dirname, outputPath) },
{ from: path.join('./src', 'tiff.raw.js'), to: path.join(__dirname, outputPath) }
]
})
],
};