【问题标题】:Can I use `DllReferencePlugin` with `webpack-dev-server`?我可以将 `DllReferencePlugin` 与 `webpack-dev-server` 一起使用吗?
【发布时间】:2016-10-27 10:13:33
【问题描述】:

如何将我的dll.bundle.js 注入到index.html 文件中?

在 chrome 控制台中,它会抛出一个错误:

Uncaught ReferenceError: vendor is not definedandUncaught TypeError: webpack_require(...) 不是函数错误。

这是因为我的Dll 没有注入到index.html 文件中

我不想使用 express 或节点服务器来托管我的静态文件。我只想使用webpack-dev-server。如何使用 Dll 捆绑包做到这一点?

【问题讨论】:

    标签: reactjs webpack


    【解决方案1】:

    嗯,你的 DLL 包通常也是在 Webpack 中构建的,就像文档 explains

    您最终负责提供该文件。您可以简单地将其作为内联脚本内联到 index.html 中:<script> //paste file here contents here </script>

    否则,让 express 在开发中静态提供文件(生产中的 CDN)是非常典型的。 This stack overflow answer 提供了一个很好的使用/设置示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-30
      • 2023-01-02
      • 1970-01-01
      • 2020-11-24
      • 2014-03-24
      • 1970-01-01
      相关资源
      最近更新 更多