redux-devtools/packages/redux-devtools-app/webpack.config.umd.ts

70 lines
1.5 KiB
TypeScript
Raw Normal View History

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 => ({
mode: env.production ? 'production' : 'development',
2019-01-10 21:51:14 +03:00
entry: {
app: ['./src/index'],
2019-01-10 21:51:14 +03:00
},
output: {
library: 'ReduxDevToolsApp',
libraryExport: 'Root',
2019-01-10 21:51:14 +03:00
libraryTarget: 'umd',
path: path.resolve(__dirname, 'umd'),
filename: env.production
? 'redux-devtools-app.min.js'
: 'redux-devtools-app.js',
2019-01-10 21:51:14 +03:00
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
2019-01-10 21:51:14 +03:00
loader: 'babel-loader',
exclude: /node_modules/,
2019-01-10 21:51:14 +03:00
},
{
test: /\.html$/,
loader: 'html-loader',
2019-01-03 17:14:25 +03:00
},
2019-01-10 21:51:14 +03:00
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
2019-01-10 21:51:14 +03:00
},
{
test: /\.woff2$/,
type: 'asset/inline',
},
],
2019-01-10 21:51:14 +03:00
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
2019-01-10 21:51:14 +03:00
plugins: [
new webpack.DefinePlugin({
'process.env': {
PLATFORM: JSON.stringify('web'),
},
}),
new ForkTsCheckerWebpackPlugin({
typescript: {
configFile: 'tsconfig.json',
},
}),
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
},
});