forked from marp-team/marp-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.web.config.js
40 lines (37 loc) · 1.17 KB
/
webpack.web.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
const path = require('path')
const { ProvidePlugin, NormalModuleReplacementPlugin } = require('webpack')
const pkg = require('./package.json')
const base = require('./webpack.base.config')
const outputPath = path.resolve(__dirname, pkg.browser)
module.exports = (env) => {
const conf = base({ ...env, outputPath })
return {
...conf,
target: 'webworker',
resolve: {
...conf.resolve,
mainFields: ['browser', 'module', 'main'],
alias: {
[path.resolve(__dirname, './src/commands/export')]: path.resolve(
__dirname,
'./src/web/commands/export'
),
'abort-controller$': require.resolve('abort-controller/browser.mjs'),
},
fallback: {
// Node.js polyfills
os: require.resolve('os-browserify/browser'),
path: require.resolve('path-browserify'),
},
},
plugins: [
...conf.plugins,
new ProvidePlugin({ process: 'process/browser.js' }),
// Workaround for https://github.com/wooorm/parse-entities/issues/19
new NormalModuleReplacementPlugin(
/parse-entities\/lib\/decode-entity\.browser\.js/,
'./decode-entity.js'
),
],
}
}