-
Notifications
You must be signed in to change notification settings - Fork 33
/
webpack.common.sw.js
38 lines (37 loc) · 1.36 KB
/
webpack.common.sw.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
const path = require('path');
const { merge } = require('webpack-merge');
const commonConfig = require('./webpack.common');
require('dotenv-defaults').config({
path: './.env',
encoding: 'utf8',
defaults: './.env.defaults'
});
// service worker script (background.ts) needs a separate webpack config,
// because it needs a different loader for WASM
module.exports = () =>
merge(commonConfig(), {
entry: {
background: path.join(__dirname, 'src/lib/scripts/background/index.ts'),
content: path.join(__dirname, 'src/lib/scripts/background/content.ts'),
inject: path.join(__dirname, 'src/lib/scripts/background/inject.ts')
},
module: {
// configuration regarding modules
rules: [
{
test: /\.wasm$/,
type: 'javascript/auto',
use: {
loader: 'webassembly-loader-sw',
options: {
export: 'instance',
importObjectProps:
// eslint-disable-next-line max-len
`'./cardano_multiplatform_lib_bg.js': __webpack_require__("../../node_modules/@dcspark/cardano-multiplatform-lib-browser/cardano_multiplatform_lib_bg.js"),
'./cardano_message_signing_bg.js': __webpack_require__("../../node_modules/@emurgo/cardano-message-signing-browser/cardano_message_signing_bg.js")`
}
}
}
]
}
});