@@ -9,57 +9,20 @@ const fs = require('fs');
9
9
10
10
// Otherwise Webpack 4 will be "helpful" and automatically mark the `punycode` package as external,
11
11
// despite us wanting to bundle it since it will be removed from future Node.js versions.
12
- delete process . binding ( "natives" ) . punycode ;
12
+ const binding = process . binding ;
13
+ process . binding = name => {
14
+ let ret = binding ( name ) ;
13
15
14
- const version = require ( '../package.json' ) . version ;
15
- const basedir = path . join ( __dirname , '../' ) ;
16
- const babelRc = JSON . parse ( fs . readFileSync ( path . join ( basedir , '.babelrc' ) , 'utf8' ) ) ;
17
-
18
- var PnpResolver = {
19
- apply : function ( resolver ) {
20
- resolver . plugin ( 'resolve' , function ( request , callback ) {
21
- if ( request . context . issuer === undefined ) {
22
- return callback ( ) ;
23
- }
24
-
25
- let basedir ;
26
- let resolved ;
27
-
28
- if ( ! request . context . issuer ) {
29
- basedir = request . path ;
30
- } else if ( request . context . issuer . startsWith ( '/' ) ) {
31
- basedir = path . dirname ( request . context . issuer ) ;
32
- } else {
33
- throw 42 ;
34
- }
35
-
36
- try {
37
- resolved = resolve . sync ( request . request , { basedir} ) ;
38
- } catch ( error ) {
39
- // TODO This is not good! But the `debug` package tries to require `supports-color` without declaring it in its
40
- // package.json, and Webpack accepts this because it's in a try/catch, so we need to do it as well.
41
- resolved = false ;
42
- }
43
-
44
- this . doResolve ( [ 'resolved' ] , Object . assign ( { } , request , {
45
- path : resolved ,
46
- } ) , '' , callback ) ;
47
- } ) ;
16
+ if ( name === `natives` ) {
17
+ delete ret . punycode ;
48
18
}
19
+
20
+ return ret ;
49
21
} ;
50
22
51
- const pnpOptions = fs . existsSync ( `${ __dirname } /../.pnp.js` ) ? {
52
- resolve : {
53
- plugins : [
54
- PnpResolver ,
55
- ]
56
- } ,
57
- resolveLoader : {
58
- plugins : [
59
- PnpResolver ,
60
- ]
61
- }
62
- } : { } ;
23
+ const version = require ( '../package.json' ) . version ;
24
+ const basedir = path . join ( __dirname , '../' ) ;
25
+ const babelRc = JSON . parse ( fs . readFileSync ( path . join ( basedir , '.babelrc' ) , 'utf8' ) ) ;
63
26
64
27
// Use the real node __dirname and __filename in order to get Yarn's source
65
28
// files on the user's system. See constants.js
@@ -119,13 +82,12 @@ const compiler = webpack({
119
82
} ,
120
83
target : 'node' ,
121
84
node : nodeOptions ,
122
- ... pnpOptions ,
123
85
} ) ;
124
86
125
87
compiler . run ( ( err , stats ) => {
126
88
const fileDependencies = stats . compilation . fileDependencies ;
127
89
const filenames = fileDependencies . map ( x => x . replace ( basedir , '' ) ) ;
128
- console . log ( util . inspect ( filenames , { maxArrayLength : null } ) ) ;
90
+ // console.log(util.inspect(filenames, {maxArrayLength: null}));
129
91
} ) ;
130
92
131
93
//
@@ -171,7 +133,6 @@ const compilerLegacy = webpack({
171
133
} ,
172
134
target : 'node' ,
173
135
node : nodeOptions ,
174
- ... pnpOptions ,
175
136
} ) ;
176
137
177
138
compilerLegacy . run ( ( err , stats ) => {
0 commit comments