-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
50 lines (50 loc) · 1.65 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 webpack = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
const FlowWebpackPlugin = require('flow-webpack-plugin')
module.exports = env => {
const name = 'tx-tulip' + (env.v ? env.v : '') + '.js'
return {
entry: './src/index.js',
mode: env.dev ? 'development' : 'production',
watch: !!env.dev,
devtool: 'source-map',
output: {
filename: name,
publicPath: env.dev ? '/dev/' : '/dist/',
path: path.resolve(__dirname, env.dev ? 'dev' : 'dist'),
globalObject: 'this',
libraryTarget: 'umd',
// libraryExport: 'default',
library: 'TX_TULIP'
},
module: {
rules: [
{
test: /\.(js|jsx|mjs)$/,
loader: 'babel-loader',
include: [path.resolve(__dirname, './src')],
options: {
extends: path.resolve(__dirname, '.babelrc')
}
}
]
},
plugins: [
new BundleAnalyzerPlugin({
analyzerPort: 5000 + ~~(Math.random() * 300)
}),
new FlowWebpackPlugin({
failOnError: false,
failOnErrorWatch: false,
reportingSeverity: 'warning',
printFlowOutput: false,
flowPath: require.main.require('flow-bin'),
flowArgs: ['--color=always'],
verbose: false,
callback: result => {}
})
]
}
}