forked from datocms/js-datocms-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
58 lines (54 loc) · 1.32 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
const webpack = require('webpack');
const path = require('path');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
// .BundleAnalyzerPlugin;
const BUILD_DIR = path.resolve(__dirname, 'dist');
const APP_DIR = path.resolve(__dirname, 'src');
const config = {
entry: `${APP_DIR}/browser.js`,
mode: 'production',
module: {
rules: [
{
test: /\.js$/,
include: APP_DIR,
loader: 'eslint-loader',
enforce: 'pre',
},
{
test: /\.js?$/,
include: APP_DIR,
loader: 'babel-loader',
},
],
},
output: {
path: BUILD_DIR,
filename: 'client.js',
library: 'Dato',
libraryTarget: 'umd',
umdNamedDefine: true,
},
devtool: 'source-map',
optimization: { minimize: true },
resolve: {
alias: {
'js-yaml$': path.resolve(__dirname, 'src/utils/nop.js'),
http$: path.resolve(__dirname, 'src/utils/nop.js'),
'https-proxy-agent$': path.resolve(__dirname, 'src/utils/nop.js'),
'./adapters/node': path.resolve(
__dirname,
'src/upload/adapters/browser.js',
),
},
},
};
config.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
}),
// new BundleAnalyzerPlugin(),
].filter(x => !!x);
module.exports = config;