File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 1
1
import { Middleware } from 'redux'
2
2
import thunkMiddleware from 'redux-thunk'
3
- // UMD-DEV-ONLY: import createImmutableStateInvariantMiddleware from 'redux-immutable-state-invariant'
3
+ /* START_REMOVE_UMD */
4
+ import createImmutableStateInvariantMiddleware from 'redux-immutable-state-invariant'
5
+ /* STOP_REMOVE_UMD */
4
6
5
7
import {
6
8
createSerializableStateInvariantMiddleware ,
@@ -55,10 +57,10 @@ export function getDefaultMiddleware<S = any>(
55
57
}
56
58
57
59
if ( process . env . NODE_ENV !== 'production' ) {
58
- /* START_REMOVE_UMD */
59
60
if ( immutableCheck ) {
60
- const createImmutableStateInvariantMiddleware = require ( 'redux-immutable-state-invariant' )
61
- . default
61
+ /* PROD_START_REMOVE_UMD */
62
+
63
+ // UMD-ONLY: const createImmutableStateInvariantMiddleware = require('redux-immutable-state-invariant').default
62
64
63
65
let immutableOptions : ImmutableStateInvariantMiddlewareOptions = { }
64
66
@@ -69,9 +71,9 @@ export function getDefaultMiddleware<S = any>(
69
71
middlewareArray . unshift (
70
72
createImmutableStateInvariantMiddleware ( immutableOptions )
71
73
)
72
- }
73
74
74
- /* STOP_REMOVE_UMD */
75
+ /* PROD_STOP_REMOVE_UMD */
76
+ }
75
77
76
78
if ( serializableCheck ) {
77
79
let serializableOptions : SerializableStateInvariantMiddlewareOptions = { }
Original file line number Diff line number Diff line change @@ -15,19 +15,26 @@ module.exports = {
15
15
case 'umd' :
16
16
delete config . external
17
17
config . output . indent = false
18
- config . plugins . push (
18
+ config . plugins . unshift (
19
19
replace ( {
20
- '// UMD-DEV-ONLY: ' : ''
20
+ '// UMD-ONLY: ' : '' ,
21
+ delimiters : [ '' , '' ]
21
22
} )
22
23
)
23
- config . plugins . push (
24
+ config . plugins . unshift (
24
25
stripCode ( {
25
- // Remove the `require()` import of RISI so we use the import statement
26
+ // Remove the `import` of RISI so we use the dynamic `require()` statement
26
27
start_comment : 'START_REMOVE_UMD' ,
27
28
end_comment : 'STOP_REMOVE_UMD'
28
29
} )
29
30
)
30
31
if ( env === 'production' ) {
32
+ config . plugins . unshift (
33
+ stripCode ( {
34
+ start_comment : 'PROD_START_REMOVE_UMD' ,
35
+ end_comment : 'PROD_STOP_REMOVE_UMD'
36
+ } )
37
+ )
31
38
config . output . file = join ( __dirname , pkg . unpkg )
32
39
} else {
33
40
config . output . file = config . output . file . replace (
You can’t perform that action at this time.
0 commit comments