forked from ipfs/js-ipfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
64 lines (62 loc) · 1.6 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const path = require('path')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/components/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'static/bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new CopyWebpackPlugin({
patterns: [{
from: 'index.html'
}, {
from: 'img',
to: 'static/img'
}]
}),
// fixes Module not found: Error: Can't resolve 'stream' in '.../node_modules/nofilter/lib'
new NodePolyfillPlugin(),
// Note: stream-browserify has assumption about `Buffer` global in its
// dependencies causing runtime errors. This is a workaround to provide
// global `Buffer` until https://github.com/isaacs/core-util-is/issues/29
// is fixed.
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser'
})
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
esmodules: true
}
}
],
'@babel/preset-react'
]
}
}
}
]
}
}