美文网首页
Day 11 Webpack Manifest

Day 11 Webpack Manifest

作者: mocobk | 来源:发表于2018-07-21 19:13 被阅读0次

    Day 11 Webpack Manifest

    Stay Hungry. Stay Foolish——Stay Hungry Stay Foolish(Apple 创始人)

    That src directory you meticulously laid out is now gone, so how does webpack manage the interaction between all of your modules? This is where the manifest data comes in.
    在webpack的编译产出中,你精心安排的src目录不见了,那webpack是怎么管理模块间交互的呢?这就是manifest数据发挥作用的地方了。

    As the compiler enters, resolves, and maps out your application, it keeps detailed notes on all your modules.
    当webpack编译器进入、分析并开始规划你的应用时,它对程序中各个模块做了详细的记录。

    This collection of data is called the "Manifest" and it's what the runtime will use to resolve and load modules once they've been bundled and shipped to the browser.
    这些数据的集合就被称为“manifest”。当你的程序被打包并传输到浏览器时,运行时程序会使用“manifest”文件中的记录来解析和加载所需的模块。

    No matter which module syntax you have chosen, those import or require statements have now become webpack require methods that point to module identifiers.
    不论你使用的是哪种模块语法,比如import,或者require,编译后,这些语句都会变成webpack版本的require方法,并最终指向你的模块标识符。

    Using the data in the manifest, the runtime will be able to find out where to retrieve the modules behind the identifiers.
    通过使用manifest中的数据,浏览器运行时才能从模块标识符中得知应该从哪取回这个模块。

    By using content hashes within your bundle file names, you can indicate to the browser when the contents of a file has changed thus invalidating the cache.
    通过在打包文件的文件名中加入内容哈希值,你可以告诉浏览器文件内容什么时候被修改过。通过这种方式,可以让过期的缓存失效。

    This is caused by the injection of the runtime and manifest which changes every build.
    这是通过运行时注入,以及每次编译都会更新的manifest文件来实现的。

    本文选自:
    https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices

    生词 音标 释义
    directory [dɪˈrɛktəri] n. 目录
    meticulously [mə'tɪkjələslɪ] adv. 精心地
    manage [ˈmænɪdʒ] v. 管理
    module [ˈmɑ:dʒul] n. 模块
    compiler [kəmˈpaɪlɚ] n. 编译程序;编译器
    resolve [rɪˈzɑ:lv] v. 分析
    map out 规划
    detailed [dɪˈteld] adj. 详细的
    collection [kəˈlɛkʃən] n. 收集
    runtime [rʌn'taɪm] 运行时间
    load [loʊd] v. 载入
    bundle [ˈbʌndl] v. 打包
    ship [ʃɪp] v. 传输;运输
    syntax [ˈsɪnˌtæks] n. 语法;句法
    statement [ˈstetmənt] n. 声明;语句
    point to 指向
    identifier [aɪˈdentɪfaɪə(r)] n. 识别符;标识符
    find out 发现
    retrieve [rɪˈtriv] v. 取回
    content [ˈkɑ:ntent] n. 内容
    hash [hæʃ] n. 哈希值
    indicate [ˈɪndɪˌket] v. 指示
    invalidate [ɪnˈvælɪˌdet] v. 使无效
    cache [kæʃ] n. 缓存
    injection [ɪnˈdʒɛkʃən] n. 注入
    build [bɪld] v. 构筑;编译

    相关文章

      网友评论

          本文标题:Day 11 Webpack Manifest

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