update-etag-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

update-etag-webpack-plugin


为本次构建生成一个具有时间戳的 json 文件,并输出到静态资源目录中

Install

npm i --save-dev update-etag-webpack-plugin

yarn add --dev update-etag-webpack-plugin

方法属性配置

属性 说明 类型 默认值
name 文本内容 string -
ignoreMode 维护的关键字信息表 HighlightKeyWord[] -

Usage


webpack.config.js

  const UpdateEtagWebpackPlugin = require("update-etag-webpack-plugin");

  module.exports = {
      mode: 'production',
      entry:'./src/index.js',
      output: {
          filename: 'index.js',
          path: path.resolve(__dirname, 'dist')
      },
      plugins: [
          new UpdateEtagWebpackPlugin({ name: "release_time" }),
      ]
  }

index.js

  fetch('/release_time.json').then((data)=>{
    const { latest_release_at } = data || {};

    const local_latest_release_at = localStorage.getItem('latest_release_at');
    if(latest_release_at !== local_latest_release_at) {
      // do update
      update()
    }
  });

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.11latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.11
1.0.01

Package Sidebar

Install

npm i update-etag-webpack-plugin

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

5.11 kB

Total Files

6

Last publish

Collaborators

  • mansonjia