2019-01-03 17:14:25 +03:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
|
2019-01-10 21:51:14 +03:00
|
|
|
module.exports = (env = {}) => ({
|
2020-08-09 04:18:45 +03:00
|
|
|
mode: env.production ? 'production' : 'development',
|
2019-01-10 21:51:14 +03:00
|
|
|
entry: {
|
2020-08-08 23:26:39 +03:00
|
|
|
app: ['./src/app/index.js'],
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
library: 'ReduxDevTools',
|
2020-08-02 01:25:17 +03:00
|
|
|
libraryExport: 'default',
|
2019-01-10 21:51:14 +03:00
|
|
|
libraryTarget: 'umd',
|
|
|
|
path: path.resolve(__dirname, 'umd'),
|
2020-08-09 04:18:45 +03:00
|
|
|
filename: env.production
|
2019-01-10 21:51:14 +03:00
|
|
|
? 'redux-devtools-core.min.js'
|
2020-08-08 23:26:39 +03:00
|
|
|
: 'redux-devtools-core.js',
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
2020-08-08 23:26:39 +03:00
|
|
|
exclude: /node_modules/,
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
2020-08-08 23:26:39 +03:00
|
|
|
loader: 'html-loader',
|
2019-01-03 17:14:25 +03:00
|
|
|
},
|
2019-01-10 21:51:14 +03:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2020-08-08 23:26:39 +03:00
|
|
|
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|gif|jpg)$/,
|
|
|
|
loader: 'url-loader',
|
2020-08-08 23:26:39 +03:00
|
|
|
options: { limit: '25000' },
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(ttf|eot|svg|woff|woff2)$/,
|
2020-08-08 23:26:39 +03:00
|
|
|
loader: 'url-loader',
|
|
|
|
},
|
|
|
|
],
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: JSON.stringify('production'),
|
2020-08-08 23:26:39 +03:00
|
|
|
PLATFORM: JSON.stringify('web'),
|
|
|
|
},
|
|
|
|
}),
|
2019-01-10 21:51:14 +03:00
|
|
|
],
|
|
|
|
externals: {
|
|
|
|
react: {
|
|
|
|
root: 'React',
|
|
|
|
commonjs2: 'react',
|
|
|
|
commonjs: 'react',
|
2020-08-08 23:26:39 +03:00
|
|
|
amd: 'react',
|
2019-01-04 22:44:26 +03:00
|
|
|
},
|
2019-01-10 21:51:14 +03:00
|
|
|
'react-dom': {
|
|
|
|
root: 'ReactDOM',
|
|
|
|
commonjs2: 'react-dom',
|
|
|
|
commonjs: 'react-dom',
|
2020-08-08 23:26:39 +03:00
|
|
|
amd: 'react-dom',
|
|
|
|
},
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
});
|