美文网首页
【webpack】webpack配置的 entry 和 outp

【webpack】webpack配置的 entry 和 outp

作者: 白小虫 | 来源:发表于2017-04-12 14:58 被阅读28次

entry :页面中的入口文件。也就是打包从哪个文件开始。

它有三种类型的值:字符串、数组、对象

  • 字符串:指定从这个文件路径下面的文件作为打包的入口文件
  • 数组 : 当存在多个入口时 ,可以使用 Array 的方式,比如依赖第三方库 bootstrap ,最终 bootstrap 会被追加到打包好的 index.js 中,数组中的最后一个会被 export。
  • 对象:设置多个打包目标。每一对键值对都对应着一个入口文件。常用语多页面入口文件配置

1、字符串方法:

字符串
编译

2、数组方法:

数组
编译

3、对象方法:

对象

output-filename :编译后输出的文件名称

output-filename的使用中,有三种占位符:

[name] is replaced by the name of the chunk.

[hash] is replaced by the hash of the compilation.

[chunkhash] is replaced by the hash of the chunk.

分别如下图所示:


name hash chunkhash

查看更多 output-filename

相关文章

网友评论

      本文标题:【webpack】webpack配置的 entry 和 outp

      本文链接:https://www.haomeiwen.com/subject/dbjmattx.html