This repository has been archived by the owner on Jan 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
webpack.config.js
71 lines (67 loc) · 1.58 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
65
66
67
68
69
70
71
var nodeExternals = require('webpack-node-externals');
/*
* Generate index.js used in `origin` npm package.
* This is used by our DApp.
*/
var serverConfig = {
entry: ["babel-polyfill", './src/index.js'],
output: {
filename: './index.js',
libraryTarget: 'commonjs2'
},
mode: 'development',
devtool: 'inline-cheap-module-source-map',
target: 'node',
externals: [nodeExternals()],
resolve: {
/**
* Overriding the default to allow jsx to be resolved automatically.
*/
extensions: ['.js', '.json', '.jsx'],
/**
* Access config from anywhere via `import settings from 'settings'``
*/
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['env', 'es2015', 'react'],
plugins: ['transform-class-properties']
}
}
]
}
}
/*
* Generate `origin.js` file that may be used standalone in browser
* This is used by our docs, and included in our github release.
*/
var clientConfig = {
entry: ["babel-polyfill", './src/index.js'],
output: {
filename: './origin.js',
libraryTarget: 'var',
library: 'Origin'
},
mode: 'production',
devtool: false,
target: 'web',
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['babel-preset-es2015'],
plugins: ['transform-class-properties']
}
}
]
}
}
module.exports = [ serverConfig, clientConfig ];