forked from mockingbot/react-resizable-rotatable-draggable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
29 lines (26 loc) · 1.06 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
const { DefinePlugin } = require('webpack')
const mode = process.env.NODE_ENV || 'production'
const isProduction = mode === 'production'
const babelOption = {
configFile: false,
babelrc: false,
cacheDirectory: isProduction,
presets: [
[ '@babel/env', { targets: isProduction ? { browser: '>= 1%' } : { node: '8.8' } } ],
[ '@babel/react' ]
],
plugins: [
[ 'styled-components' ],
[ '@babel/proposal-class-properties' ],
[ 'minify-replace', { replacements: [ { identifierName: '__DEV__', replacement: { type: 'booleanLiteral', value: !isProduction } } ] } ]
]
}
module.exports = {
mode,
bail: isProduction,
output: { path: `${__dirname}/example`, filename: 'index.js', library: 'RRRD', libraryTarget: 'umd' },
entry: { index: `${__dirname}/src/index.example` },
module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: babelOption } } ] },
plugins: [ new DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(mode), __DEV__: !isProduction }) ],
optimization: { minimize: isProduction }
}