@@ -16,13 +16,14 @@ const declareOpts = require('../lib/declareOpts');
1616const Promise = require ( 'promise' ) ;
1717// @Denis 获取模块名单
1818const fs = require ( 'fs' ) ;
19+ const cwd = process . cwd ( ) ;
1920let rnBlackList = [ ] ;
2021let rnSimpleBL = [ ] ;
2122let rnRegExpBL = [ ] ;
2223
2324if ( process . env . RN_BLACKLIST_PATH ) {
2425 rnBlackList = require ( process . env . RN_BLACKLIST_PATH ) ;
25- } else if ( fs . existsSync ( path . join ( process . cwd ( ) , 'rn-blacklist.js' ) ) ) {
26+ } else if ( fs . existsSync ( path . join ( cwd , 'rn-blacklist.js' ) ) ) {
2627 rnBlackList = require ( process . cwd ( ) + '/rn-blacklist.js' ) ;
2728}
2829
@@ -187,7 +188,7 @@ class Resolver {
187188 } else {
188189 let dependencies = [ ] ;
189190 resolutionResponse . dependencies . forEach ( mp => {
190- if ( rnSimpleBL . indexOf ( mp . moduleName ) > - 1 || this . _regexpBLTest ( mp . moduleName ) ) {
191+ if ( rnSimpleBL . indexOf ( mp . moduleName ) > - 1 || this . _regexpBLTest ( mp . path ) ) {
191192 resolutionResponse . _mappings [ mp . hash ( ) ] && delete resolutionResponse . _mappings [ mp . hash ( ) ] ;
192193 } else {
193194 console . log ( "> " , mp . moduleName ) ;
@@ -202,9 +203,10 @@ class Resolver {
202203 }
203204
204205 // @Denis
205- _regexpBLTest ( moduleName ) {
206+ // 正则对path的匹配
207+ _regexpBLTest ( modulePath ) {
206208 for ( const i in rnRegExpBL ) {
207- if ( rnRegExpBL [ i ] . test ( moduleName ) ) {
209+ if ( rnRegExpBL [ i ] . test ( modulePath . replace ( cwd , '' ) ) ) {
208210 return true ;
209211 }
210212 }
0 commit comments