-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
50 lines (46 loc) · 1.08 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
const path = require('path')
const { merge } = require('webpack-merge')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const common = require('./webpack.common')
const mode = process.env.NODE_ENV || 'development'
const dev = mode === 'development'
let context = path.join(__dirname, '/lib')
let entry = ['core-js/stable', './index.js']
let output = {
path: path.join(__dirname, '/dist'),
filename: 'react-very-simple-data-table.js',
library: 'SimpleDataTable',
libraryTarget: 'umd',
}
let externals = [
{
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
},
]
let plugins = []
if (dev) {
context = path.join(__dirname)
entry = ['core-js/stable', './examples/full-featured.jsx']
output = {
path: path.join(__dirname, '/dist'),
filename: 'react-very-simple-data-table-example.js',
}
externals = []
plugins = [
new HtmlWebpackPlugin({
template: path.join(__dirname, '/test/index.html'),
}),
]
}
module.exports = merge(common, {
context,
entry,
output,
externals,
plugins,
})