redux-devtools/packages/react-json-tree/webpack.config.umd.js

52 lines
1005 B
JavaScript
Raw Normal View History

const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
2019-01-10 21:51:14 +03:00
module.exports = (env = {}) => ({
mode: 'production',
entry: {
app: ['./src/index.js'],
2019-01-10 21:51:14 +03:00
},
output: {
library: 'ReactJsonTree',
libraryTarget: 'umd',
path: path.resolve(__dirname, 'umd'),
filename: env.minimize ? 'react-json-tree.min.js' : 'react-json-tree.js',
2019-01-10 21:51:14 +03:00
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
2019-01-10 21:51:14 +03:00
},
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
2019-01-10 21:51:14 +03:00
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
},
2019-01-10 21:51:14 +03:00
},
optimization: {
minimize: !!env.minimize,
minimizer: [
new TerserPlugin({
terserOptions: {
safari10: true,
},
}),
],
2019-01-10 21:51:14 +03:00
},
performance: {
hints: false,
},
2019-01-10 21:51:14 +03:00
});