This commit is contained in:
Nathan Bierema 2020-10-25 17:45:02 -04:00
parent d3aa75aeaa
commit d6d82ada10
2 changed files with 16 additions and 7 deletions

View File

@ -25,8 +25,8 @@
"build:types": "tsc --emitDeclarationOnly", "build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline", "build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline",
"build:web": "rimraf ./build/web && webpack -p --env.platform=web --progress", "build:web": "rimraf ./build/web && webpack -p --env.platform=web --progress",
"build:umd": "rimraf ./umd && webpack --progress --config webpack.config.umd.js", "build:umd": "rimraf ./umd && webpack --progress --config webpack.config.umd.ts",
"build:umd:min": "webpack --env.production --progress --config webpack.config.umd.js", "build:umd:min": "webpack --env.production --progress --config webpack.config.umd.ts",
"clean": "rimraf lib", "clean": "rimraf lib",
"test": "jest", "test": "jest",
"lint": "eslint . --ext .ts,.tsx", "lint": "eslint . --ext .ts,.tsx",

View File

@ -1,10 +1,11 @@
const path = require('path'); import * as path from 'path';
const webpack = require('webpack'); import * as webpack from 'webpack';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
module.exports = (env = {}) => ({ module.exports = (env: { production?: boolean } = {}) => ({
mode: env.production ? 'production' : 'development', mode: env.production ? 'production' : 'development',
entry: { entry: {
app: ['./src/app/index.js'], app: ['./src/app/index'],
}, },
output: { output: {
library: 'ReduxDevTools', library: 'ReduxDevTools',
@ -18,7 +19,7 @@ module.exports = (env = {}) => ({
module: { module: {
rules: [ rules: [
{ {
test: /\.js$/, test: /\.(js|ts)x?$/,
loader: 'babel-loader', loader: 'babel-loader',
exclude: /node_modules/, exclude: /node_modules/,
}, },
@ -41,6 +42,9 @@ module.exports = (env = {}) => ({
}, },
], ],
}, },
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
@ -48,6 +52,11 @@ module.exports = (env = {}) => ({
PLATFORM: JSON.stringify('web'), PLATFORM: JSON.stringify('web'),
}, },
}), }),
new ForkTsCheckerWebpackPlugin({
typescript: {
configFile: 'tsconfig.json',
},
}),
], ],
externals: { externals: {
react: { react: {