webbundle-webpack-plugin:生成Web Bundles的Webpack插件

webbundle-webpack-plugin是一个Webpack插件,用于生成Web Bundles输出。由于当前规范仍在草稿阶段,此插件也处于Alpha版本。该插件要求Node v10.0.0以上和Webpack v4.0.0以上版本。通过npm安装:npm install webbundle-webpack-plugin --save-dev。用法如下,假设应用程序入口点为src/index.js,静态文件(包括index.html)位于static目录中。

/* webpack.config.js */
const path = require('path');
const WebBundlePlugin = require('webbundle-webpack-plugin');
module.exports = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
  },
  plugins: [
    new WebBundlePlugin({
      staticDir: 'static',
    }),
  ],
};
zip 文件大小:47.54KB