Array-Huang / webpack-seed

这是一个基于webpack的多页应用脚手架
https://segmentfault.com/a/1190000006843916
MIT License
1.19k stars 283 forks source link

webpackJsonp is not defined #61

Closed DonaldY closed 6 years ago

DonaldY commented 6 years ago

html 打开后发现console里有 webpackJsonp is not defined

在 plugins.config.js中, 'commons/commons' 在 page 后然后就报这个。

pageArr.forEach((page) => {
  const htmlPlugin = new HtmlWebpackPlugin({
    filename: `${page}/page.html`,
    template: path.resolve(dirVars.pagesDir, `./${page}/html.js`),
    chunks: ['webpack-runtime', page, 'commons/commons'],
    hash: true, // 为静态资源生成hash值
    xhtml: true,
  });
  configPlugins.push(htmlPlugin);
});

so, 公共文件要先引入。

有理解错误的话,望见谅,望能指出。