forked from fergiemcdowall/fergies-inverted-index
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
49 lines (47 loc) · 1.16 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
const path = require('path')
const webpack = require('webpack')
const glob = require("glob");
const config = {
plugins: [
// Webpack 5 no longer polyfills 'process'
new webpack.ProvidePlugin({
process: 'process/browser',
}),
// 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
}
}
}
module.exports = [{
...config,
mode: 'production',
entry: './src/main.js',
output: {
path: path.resolve('dist'),
filename: 'fergies-inverted-index.js',
library: 'FergiesInvertedIndex'
}
}, {
...config,
mode: 'development',
entry: glob.sync('./test/src/*-test.js'),
output: {
path: path.resolve('test/sandbox'),
filename: 'browser-tests.js'
},
}]