@@ -14,6 +14,26 @@ module.exports = (options = {}) => ({
1414 mode : isCi ? "production" : "development" ,
1515 module : {
1616 rules : [ {
17+ loader : "string-replace-loader" ,
18+ test : / \. ( j | t ) s / ,
19+ options : {
20+ multiple : [ {
21+ // These will be handled by file-loader. We need the location because
22+ // they are parsed as URIs and will throw errors if not fully formed.
23+ search : "require\\.toUrl\\(" ,
24+ replace : "location.protocol + '//' + location.host + '/' + require('file-loader?name=[path][name].[ext]!' + " ,
25+ flags : "g" ,
26+ } , {
27+ search : "require\\.__\\$__nodeRequire" ,
28+ replace : "require" ,
29+ flags : "g" ,
30+ } , {
31+ search : "\\.attributes\\[([^\\]]+)\\] = ([^;]+)" ,
32+ replace : ".setAttribute($1, $2)" ,
33+ flags : "g" ,
34+ } ] ,
35+ } ,
36+ } , {
1737 test : / \. ( j s ) / ,
1838 exclude : / t e s t / ,
1939 } , {
@@ -22,12 +42,12 @@ module.exports = (options = {}) => ({
2242 loader : "ignore-loader" ,
2343 } ] ,
2444 } , {
25- test : / e l e c t r o n - b r o w s e r .+ \. h t m l $ | c o d e \/ e l e c t r o n - b r o w s e r \/ .+ \. c s s $ | m a r k d o w n \. c s s $ / ,
45+ // These are meant to run in separate pages, like the issue reporter or
46+ // process explorer. Ignoring for now since otherwise their CSS is
47+ // included in the main CSS.
48+ test : / e l e c t r o n - b r o w s e r .+ \. h t m l $ | c o d e \/ e l e c t r o n - b r o w s e r \/ .+ \. c s s $ / ,
2649 use : [ {
27- loader : "file-loader" ,
28- options : {
29- name : "[path][name].[ext]" ,
30- } ,
50+ loader : "ignore-loader" ,
3151 } ] ,
3252 } , {
3353 test : / \. n o d e $ / ,
@@ -39,9 +59,8 @@ module.exports = (options = {}) => ({
3959 test : / ( ^ .? | \. [ ^ d ] | [ ^ . ] d | [ ^ . ] [ ^ d ] ) \. t s x ? $ / ,
4060 } , {
4161 // Test CSS isn't required. The rest is supposed to be served in separate
42- // pages or iframes, so we need to skip it here and serve it with the file
43- // loader instead.
44- exclude : / t e s t | c o d e \/ e l e c t r o n - b r o w s e r \/ .+ \. c s s | m a r k d o w n \. c s s $ / ,
62+ // pages or iframes so we don't need to include it here.
63+ exclude : / t e s t | c o d e \/ e l e c t r o n - b r o w s e r \/ .+ \. c s s $ / ,
4564 test : / \. s ? c s s $ / ,
4665 // This is required otherwise it'll fail to resolve CSS in common.
4766 include : root ,
@@ -53,7 +72,7 @@ module.exports = (options = {}) => ({
5372 loader : "sass-loader" ,
5473 } ] ,
5574 } , {
56- test : / \. ( s v g | p n g | t t f | w o f f | e o t | m d ) $ / ,
75+ test : / \. ( s v g | p n g | t t f | w o f f | e o t ) $ / ,
5776 use : [ {
5877 loader : "file-loader" ,
5978 options : {
0 commit comments