File tree Expand file tree Collapse file tree 2 files changed +22
-33
lines changed Expand file tree Collapse file tree 2 files changed +22
-33
lines changed Original file line number Diff line number Diff line change 1
1
const path = require ( "path" ) ;
2
2
const webpack = require ( "webpack" ) ;
3
3
const merge = require ( "webpack-merge" ) ;
4
- const StringReplacePlugin = require ( "string-replace-webpack-plugin" ) ;
5
- const HappyPack = require ( "happypack" ) ;
6
4
7
5
module . exports = merge ( {
8
6
devtool : "none" ,
9
7
mode : "development" ,
10
- module : {
11
- rules : [
12
- {
13
- test : / @ o c l i f \/ c o m m a n d \/ l i b \/ i n d e x \. j s / ,
14
- loader : StringReplacePlugin . replace ( {
15
- replacements : [
16
- {
17
- // This is required otherwise it attempts to require("package.json")
18
- pattern : / c h e c k N o d e V e r s i o n \( \) \; / ,
19
- replacement : ( ) => / / ,
20
- }
21
- ]
22
- } ) ,
23
- } ,
24
- {
25
- test : / n o d e \- p t y \/ l i b \/ i n d e x \. j s / ,
26
- loader : StringReplacePlugin . replace ( {
27
- replacements : [
28
- {
29
- pattern : / e x p o r t s \. n a t i v e .* ; / ,
30
- replacement : ( ) => "exports.native = null;" ,
31
- }
32
- ]
33
- } ) ,
34
- } ,
35
- ] ,
36
- } ,
37
8
output : {
38
9
filename : "cli.js" ,
39
10
path : path . join ( __dirname , "./out" ) ,
Original file line number Diff line number Diff line change @@ -91,15 +91,33 @@ module.exports = (options = {}) => ({
91
91
loader : "string-replace-loader" ,
92
92
options : {
93
93
multiple : [ {
94
- // These will be handled by file-loader. We need the location because
95
- // they are parsed as URIs and will throw errors if not fully formed.
96
- // The !! prefix causes it to ignore other loaders (doesn't work).
97
94
search : "const spdlog.*;" ,
98
95
replace : "const spdlog = __non_webpack_require__(global.SPDLOG_LOCATION);" ,
99
96
flags : "g" ,
100
97
} ] ,
101
98
} ,
102
- } , ] ,
99
+ } , {
100
+ // This is required otherwise it attempts to require("package.json")
101
+ test : / @ o c l i f \/ c o m m a n d \/ l i b \/ i n d e x \. j s / ,
102
+ loader : "string-replace-loader" ,
103
+ options : {
104
+ multiple : [ {
105
+ search : "checkNodeVersion\\(\\);" ,
106
+ replace : "" ,
107
+ flags : "g" ,
108
+ } ] ,
109
+ } ,
110
+ } , {
111
+ test : / n o d e \- p t y \/ l i b \/ i n d e x \. j s / ,
112
+ loader : "string-replace-loader" ,
113
+ options : {
114
+ multiple : [ {
115
+ search : "exports\\.native.*;" ,
116
+ replace : "exports.native = null;" ,
117
+ flags : "g" ,
118
+ } ] ,
119
+ } ,
120
+ } ] ,
103
121
noParse : / \/ t e s t \/ | \. t e s t \. j s x ? | \. t e s t \. t s x ? | t s c o n f i g .+ \. j s o n $ / ,
104
122
} ,
105
123
resolve : {
You can’t perform that action at this time.
0 commit comments