- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://webpack.js.org
- 软件文档: https://webpack.js.org/concepts/
- 官方下载: https://github.com/webpack/webpack/releases
软件介绍
webpack 是一个模块打包器,主要目的是在浏览器上打包 JavaScript 文件。
原理
特性
可创建单个或多个按需加载的块,以减少初始加载时间
在编译期间会解决依赖关系,减少了运行时的大小
加载器可以在编译时预处理文件,如 coffee-script 到 javascript
示例代码
// webpack is a module bundler
// This means webpack takes modules with dependencies
// and emits static assets representing those modules.
// dependencies can be written in CommonJs
var commonjs = require("./commonjs");
// or in AMD
define(["amd-module", "../file"], function(amdModule, file) {
// while previous constructs are sync
// this is async
require(["big-module/big/file"], function(big) {
// for async dependencies webpack splits
// your application into multiple "chunks".
// This part of your application is
// loaded on demand (Code Splitting)
var stuff = require("../my/stuff");
// "../my/stuff" is also loaded on demand
// because it's in the callback function
// of the AMD require
});
});
require("coffee!./cup.coffee");
// "Loaders" can be used to preprocess files.
// They can be prefixed in the require call
// or configured in the configuration.
require("./cup");
// This does the same when you add ".coffee" to the extensions
// and configure the "coffee" loader for /\.coffee$/
function loadTemplate(name) {
return require("./templates/" + name + ".jade");
// many expressions are supported in require calls
// a clever parser extracts information and concludes
// that everything in "./templates" that matches
// /\.jade$/ should be included in the bundle, as it
// can be required.
}
// ... and you can combine everything
function loadTemplateAsync(name, callback) {
require(["bundle?lazy!./templates/" + name + ".jade"],
function(templateBundle) {
templateBundle(callback);
});
}
YC创业营: 硅谷顶级创业孵化器如何改变世界
兰德尔·斯特罗斯 (Randall Stross) / 苏健 / 浙江人民出版社 / 2014-8-1 / CNY 52.90
在互联网创业成本日益降低、融资却越来越难的今天,硅谷的Y Combinator因何成为全世界创业者趋之若鹜的创业圣地?为什么25岁左右的青年最适合创业?创业者如何才能在遴选面试中脱颖而出?为什么YC特别看好那些主要由黑客组成的创业团队? YC真的歧视女性吗?如何想出能够赢得投资的新点子?创业者应该如何寻找联合创始人? 获准进入Y Combinator及其创业公司全程跟踪批量投资项目的第一人,......一起来看看 《YC创业营: 硅谷顶级创业孵化器如何改变世界》 这本书的介绍吧!
