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
|
|
|
|
2021-12-05 06:28:45 +03:00
|
|
|
export default (env: { production?: boolean } = {}): webpack.Configuration => ({
|
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: {
|
2022-01-10 18:41:53 +03:00
|
|
|
library: 'ReduxDevToolsApp',
|
|
|
|
libraryExport: 'Root',
|
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
|
|
|
},
|
|
|
|
{
|
2022-01-16 17:37:49 +03:00
|
|
|
test: /\.woff2$/,
|
|
|
|
type: 'asset/inline',
|
2020-08-08 23:26:39 +03:00
|
|
|
},
|
|
|
|
],
|
2019-01-10 21:51:14 +03:00
|
|
|
},
|
2020-10-26 02:32:04 +03:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
|
|
},
|
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
|
|
|
},
|
|
|
|
});
|