2015-09-26 42 views
2

我已經有一個基於React for Web的項目。現在,我在這裏創建了一個React-Native項目。如果我與react-native bundle捆綁在一起,react-native會捆綁我的所有文件,然後提示很多警告。所以我想在/www下製作react-native忽略文件。有沒有辦法讓react-native忽略一些不捆綁它們的文件?

我嘗試了這些行動,但沒用:

  1. 添加我的路徑sharedBlacklistWildcardsnode_modules/react-native/packager/blacklist.js。我的路徑.flowconfig

我檢查了文檔,但沒有發現任何有用的東西。我該怎麼做,或者如果我有一個錯誤的想法?

回答

1

好吧,我修改了node_modules/react-native中的文件。這是迄今爲止我發現的唯一途徑,我仍然期待着一個更好的解決方案。

node_modules\react-native\packager\react-packager\src\DependencyResolver\fastfs.js用於掃描文件。所以我rewrited File::getFiles這樣:

getFiles() { 
 
    return _.flatten(_.values(this.children).filter(
 
     file => !/platforms$|www$/.test(file.path) 
 
    ).map(file => { 
 
     if (file.isDir) { 
 
      return file.getFiles(); 
 
     } else { 
 
      return file; 
 
     } 
 
    })); 
 
    }

+0

你收到這方面的任何更好的解決方案。我也有同樣的問題 –

相關問題