Skip to content

Commit ac32db0

Browse files
alex-ketchmarkerikson
authored andcommitted
fix: UMD dev build by removing runtime usage of require statement (#317)
1 parent 6d3f470 commit ac32db0

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/getDefaultMiddleware.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Middleware } from 'redux'
22
import thunkMiddleware from 'redux-thunk'
3-
/* START_REMOVE_UMD */
3+
/* PROD_START_REMOVE_UMD */
44
import createImmutableStateInvariantMiddleware from 'redux-immutable-state-invariant'
5-
/* STOP_REMOVE_UMD */
5+
/* PROD_STOP_REMOVE_UMD */
66

77
import {
88
createSerializableStateInvariantMiddleware,
@@ -61,9 +61,6 @@ export function getDefaultMiddleware<S = any>(
6161
if (process.env.NODE_ENV !== 'production') {
6262
if (immutableCheck) {
6363
/* PROD_START_REMOVE_UMD */
64-
65-
// UMD-ONLY: const createImmutableStateInvariantMiddleware = require('redux-immutable-state-invariant').default
66-
6764
let immutableOptions: ImmutableStateInvariantMiddlewareOptions = {}
6865

6966
if (!isBoolean(immutableCheck)) {
@@ -73,7 +70,6 @@ export function getDefaultMiddleware<S = any>(
7370
middlewareArray.unshift(
7471
createImmutableStateInvariantMiddleware(immutableOptions)
7572
)
76-
7773
/* PROD_STOP_REMOVE_UMD */
7874
}
7975

tsdx.config.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { join } = require('path')
22

3-
const replace = require('rollup-plugin-replace')
43
const stripCode = require('rollup-plugin-strip-code')
54

65
const pkg = require('./package.json')
@@ -15,19 +14,6 @@ module.exports = {
1514
case 'umd':
1615
delete config.external
1716
config.output.indent = false
18-
config.plugins.unshift(
19-
replace({
20-
'// UMD-ONLY: ': '',
21-
delimiters: ['', '']
22-
})
23-
)
24-
config.plugins.unshift(
25-
stripCode({
26-
// Remove the `import` of RISI so we use the dynamic `require()` statement
27-
start_comment: 'START_REMOVE_UMD',
28-
end_comment: 'STOP_REMOVE_UMD'
29-
})
30-
)
3117
if (env === 'production') {
3218
config.plugins.unshift(
3319
stripCode({

0 commit comments

Comments
 (0)