报错:
Error: Cannot call .tap() on a plugin that has not yet been defined. Call plugin('html').use(<Plugin>) first.
配置
if (isProd) { config .plugin("html") .tap((args) => { args[0].cdn = assetsCDN.assets; return args; }); }
修改后
const HtmlWebpackPlugin = require("html-webpack-plugin");
if (isProd) { config .plugin("html") .use(HtmlWebpackPlugin) .tap((args) => { args.cdn = assetsCDN.assets; return args; }); }
args[0].cdn = assetsCDN.assets; // 报错:TypeError: Cannot set property 'cdn' of undefined