Webpack



其優勢主要可以歸類爲如下幾個:
1. webpack 是以 commonJS 的形式來書寫腳本滴,但對 AMD/CMD 的支持也很全面,方便舊項目進行代碼遷移。
2. 能被模塊化的不僅僅是 JS 了。
3. 開發便捷,能替代部分 grunt/gulp 的工作,比如打包、壓縮混淆、圖片轉base64等。
4. 擴展性強,插件機制完善,特別是支持 React 熱插拔(見react-hot-loader )的功能讓人眼前一亮。
In the wild, there are many project structures. Some projects useapp instead of src. Some projects use dist or build instead of bin. Projects with tests usually usetest, tests, spec, specs or colocate the test files in the source folder.

webpack only supports JavaScript modules natively, but most people will be using a transpiler for ES2015, CoffeeScript, TypeScript, etc. They can be used in webpack by usingloaders.

webpack can only handle JavaScript natively, so we need thecss-loader to process CSS files. We also need thestyle-loader to apply the styles in the CSS file.

We don’t want to manually recompile after every change…
webpack --progress --colors --watch

webpack可以說是一個大而全的前端構建工具。它實現了模塊化開發和靜態文件處理兩大問題。




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章