我爲通用JavaScript應用程序構建了一個Webpack。我正在使用DLL插件預先構建我的所有node_modules。我添加了一個導致DLL構建出錯的lib(請參見下文)。從Webpack DLL中排除模塊構建
我可以添加一個JSON加載器來解決這個問題。但是我根本不需要React代碼中的lib。我將它添加到我的排除列表中,但仍然出現錯誤。
這裏的錯誤:
Building the Webpack DLL...
Hash: a69a927bfa72ddef88d5
Version: webpack 2.1.0-beta.15
Time: 7152ms
Asset Size Chunks Chunk Names
reactBoilerplateDeps.dll.js 5.58 MB 0 [emitted] reactBoilerplateDeps
chunk {0} reactBoilerplateDeps.dll.js (reactBoilerplateDeps) 5.07 MB [rendered]
[1135] dll reactBoilerplateDeps 12 bytes {0} [built]
+ 1137 hidden modules
ERROR in ./~/constants-browserify/constants.json
Module parse failed: /Users/steve/Projects/elucidate/node_modules/constants-browserify/constants.json Unexpected token (2:12)
You may need an appropriate loader to handle this file type.
| {
| "O_RDONLY": 0,
| "O_WRONLY": 1,
| "O_RDWR": 2,
@ ./~/graceful-fs/polyfills.js 2:16-36
的WebPack DLL構建腳本:
"dllPlugin": {
"path": "node_modules/react-boilerplate-dlls",
"exclude": [
"chalk",
"compression",
"cross-env",
"express",
"ip",
"minimist",
"sanitize.css",
"multiparty",
"cloudinary",
"winston",
"morgan",
"body-parser",
"request-promise",
"winston-graylog2",
"yauzl",
"busboy",
"graceful-fs"
],
"include": [
"core-js",
"lodash",
"eventsource-polyfill"
]
},
我試圖追逐依賴放入我的排除數組。這花了太長時間,並且將JSON加載器添加到DLL構建中。 – spdaly