2020-10-26 02:32:04 +03:00
|
|
|
import * as path from 'path';
|
|
|
|
import * as webpack from 'webpack';
|
|
|
|
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
2019-01-03 17:14:25 +03:00
|
|
|
|
2020-10-26 02:32:04 +03:00
|
|
|
module.exports = (env: { production?: boolean } = {}) => ({
|
2020-08-09 04:18:45 +03:00
|
|
|
mode: env.production ? 'production' : 'development',
|
2019-01-10 21:51:14 +03:00
|
|
|
entry: {
|
2020-12-22 20:02:14 +03:00
|
|
|
app: ['./src/index'],
|
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
|
2020-12-22 20:02:14 +03:00
|
|
|
? 'redux-devtools-app.min.js'
|
|
|
|
: 'redux-devtools-app.js',
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2020-10-26 02:32:04 +03:00
|
|
|
test: /\.(js|ts)x?$/,
|
2019-01-10 21:51:14 +03:00
|
|
|
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
|
|
|
},
|
2020-10-26 02:32:04 +03:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
2021-08-29 07:09:37 +03:00
|
|
|
fallback: {
|
|
|
|
path: require.resolve('path-browserify'),
|
|
|
|
},
|
2020-10-26 02:32:04 +03:00
|
|
|
},
|
2019-01-10 21:51:14 +03:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
2020-08-08 23:26:39 +03:00
|
|
|
PLATFORM: JSON.stringify('web'),
|
|
|
|
},
|
|
|
|
}),
|
2020-10-26 02:32:04 +03:00
|
|
|
new ForkTsCheckerWebpackPlugin({
|
|
|
|
typescript: {
|
|
|
|
configFile: 'tsconfig.json',
|
|
|
|
},
|
|
|
|
}),
|
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
|
|
|
},
|
|
|
|
});
|