File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -113,11 +113,22 @@ function setWebpackOptions (api, options) {
113
113
...alias ,
114
114
...api . resolveWebpackConfig ( ) . resolve . alias
115
115
}
116
+ function replacer ( key , value ) {
117
+ if ( value instanceof RegExp ) return '__REGEXP ' + value . toString ( )
118
+ else return value
119
+ }
120
+ function toRegex ( match , p1 , regex ) {
121
+ return regex . replace ( '\\\\' , '\\' )
122
+ }
123
+ let stringConfig = JSON . stringify ( config , replacer ) . replace (
124
+ / ( " _ _ R E G E X P ) ( .+ ?) ( " ) (? = , ) / ,
125
+ toRegex
126
+ )
116
127
if ( ! fs . existsSync ( api . resolve ( '.' ) + '/dist_electron' ) ) {
117
128
fs . mkdirSync ( api . resolve ( '.' ) + '/dist_electron' )
118
129
}
119
130
fs . writeFileSync (
120
131
api . resolve ( '.' ) + '/dist_electron/webpack.renderer.additions.js' ,
121
- 'module.exports=' + JSON . stringify ( config )
132
+ 'module.exports=' + stringConfig
122
133
)
123
134
}
You can’t perform that action at this time.
0 commit comments