-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.config.js
More file actions
56 lines (53 loc) · 1.32 KB
/
webpack.config.js
File metadata and controls
56 lines (53 loc) · 1.32 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
import glob from 'glob'
import path from 'path'
import webpack from 'webpack'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const config = {
plugins: [
// Webpack 5 no longer polyfills 'process'
new webpack.ProvidePlugin({
process: 'process/browser.js'
}),
// as per https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
})
],
target: ['web'],
resolve: {
fallback: {
// BREAKING CHANGE: webpack < 5 used to include polyfills for
// node.js core modules by default. This is no longer the
// case.
assert: false,
buffer: require.resolve('buffer/'),
fs: false,
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify'),
util: false,
os: require.resolve('os-browserify')
}
}
}
export default [
{
...config,
mode: 'production',
entry: './src/entrypoints/browser.js',
output: {
path: path.resolve('dist'),
filename: 'fergies-inverted-index.js',
library: 'FergiesInvertedIndex'
}
},
{
...config,
mode: 'production',
entry: glob.sync('./test/src/*-test.js'),
output: {
path: path.resolve('test/sandbox'),
filename: 'browser-tests.js'
}
}
]