問題描述
Webpack bundle ENOENT:沒有這樣的文件或目錄 fs.readdirSync (Webpack bundle ENOENT: no such file or directory fs.readdirSync)
我們想創建在 AWS Lambda 上運行的微型應用程序。我們正在為此研究 webpack 2。但是,我們有遺留代碼使用 fs.readdirSync
來獲取文件/模塊名稱列表以生成模塊列表。執行包時,我們得到一個錯誤 Error: ENOENT: no such file or directory, scandir '/innerLib'
因為 webpack 不知道執行 fs.readdirSync(path.resolve(__dirname, 'innerLib'));
在文件 lib/lib.js
中並在捆綁期間解析文件名數組。
在不對遺留代碼進行重大更改的情況下,我們可以對 wepback 採取哪些方法。我在下面和 isurfbecause、christopher fujino)