-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
45 lines (45 loc) · 1.11 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
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable import/no-commonjs */
module.exports = {
entry: {
sqliteWasm: './lib/index.js',
},
output: {
library: 'sqliteWasm',
libraryExport: 'default',
libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this",
},
mode: 'development',
module: {
rules: [
{
enforce: 'pre',
test: /\.(js|jsx|mjs)$/,
exclude: [/node_modules/, /build/],
use: 'eslint-loader',
},
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
},
},
],
// Webpack breaks .wasm file loading. So redefine the default rules
// and remove the default .wasm rule.
// See: https://github.com/webpack/webpack/blob/d5e26f728adb63a1fca080ef728fd627952a921d/lib/WebpackOptionsDefaulter.js#L83-L86
// See: https://github.com/webpack/webpack/issues/6725
defaultRules: [
{
type: 'javascript/auto',
resolve: {},
},
{
test: /\.json$/i,
type: 'json',
},
],
},
};