2019-01-03 17:14:25 +03:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
2019-01-05 03:05:52 +03:00
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
2019-01-03 17:14:25 +03:00
|
|
|
|
|
|
|
module.exports = (env = {}) => (
|
|
|
|
{
|
2019-01-04 22:44:26 +03:00
|
|
|
mode: 'production',
|
2019-01-03 17:14:25 +03:00
|
|
|
entry: {
|
|
|
|
app: ['./src/app/index.js']
|
|
|
|
},
|
|
|
|
output: {
|
2019-01-03 23:43:56 +03:00
|
|
|
library: 'ReduxDevTools',
|
2019-01-03 17:14:25 +03:00
|
|
|
libraryTarget: 'umd',
|
2019-01-04 22:44:26 +03:00
|
|
|
path: path.resolve(__dirname, 'umd'),
|
2019-01-05 03:05:52 +03:00
|
|
|
filename: env.minimize ? 'redux-devtools-core.min.js' : 'redux-devtools-core.js'
|
2019-01-03 17:14:25 +03:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: /node_modules/
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
loader: 'html-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
{ loader: 'style-loader' },
|
|
|
|
{ loader: 'css-loader' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|gif|jpg)$/,
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: { limit: '25000' }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(ttf|eot|svg|woff|woff2)$/,
|
|
|
|
loader: 'url-loader'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: JSON.stringify('production'),
|
|
|
|
PLATFORM: JSON.stringify('web')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
externals: {
|
|
|
|
react: {
|
|
|
|
root: 'React',
|
|
|
|
commonjs2: 'react',
|
|
|
|
commonjs: 'react',
|
|
|
|
amd: 'react'
|
|
|
|
},
|
|
|
|
'react-dom': {
|
|
|
|
root: 'ReactDOM',
|
|
|
|
commonjs2: 'react-dom',
|
|
|
|
commonjs: 'react-dom',
|
|
|
|
amd: 'react-dom'
|
|
|
|
}
|
2019-01-04 22:44:26 +03:00
|
|
|
},
|
2019-01-05 03:05:52 +03:00
|
|
|
optimization: {
|
|
|
|
minimize: !!env.minimize,
|
|
|
|
minimizer: [
|
|
|
|
new TerserPlugin({
|
|
|
|
terserOptions: {
|
|
|
|
safari10: true
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]
|
|
|
|
},
|
2019-01-04 22:44:26 +03:00
|
|
|
performance: {
|
|
|
|
hints: false
|
2019-01-03 17:14:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|