Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack 从鲍尔迁移+;吞咽到网页包-将依赖项注入到html_Webpack_Gulp_Bower - Fatal编程技术网

Webpack 从鲍尔迁移+;吞咽到网页包-将依赖项注入到html

Webpack 从鲍尔迁移+;吞咽到网页包-将依赖项注入到html,webpack,gulp,bower,Webpack,Gulp,Bower,我是从bower+gulp迁移过来的。我曾经使用过gulp注入插件: 使用这种注入单个依赖项的方式: <!DOCTYPE html> <html> <head> <title>My index</title> <!-- bower:css --> <!-- bower installed css files will go here... --> <!-- endinject -->

我是从bower+gulp迁移过来的。我曾经使用过gulp注入插件: 使用这种注入单个依赖项的方式:

<!DOCTYPE html>
<html>
<head>
  <title>My index</title>
  <!-- bower:css -->
  <!-- bower installed css files will go here... -->
  <!-- endinject -->
  <!-- inject:css -->
  <!-- built css files will go here... -->
  <!-- endinject -->
</head>
<body>

  <!-- bower:js -->
  <!-- bower installed scripts will go here... -->
  <!-- endinject -->
  <!-- inject:js -->
  <!-- app scripts will go here... -->
  <!-- endinject -->
</body>
</html>

我的索引
对于产品,我会将所有依赖项缩小为一个js,并使用当前时间戳的散列来覆盖浏览器所做的任何缓存

现在,我正试图转到webpack(作为移除bower的一部分,并改用npm)

我想知道两件事,都是在html依赖注入方面:

  • 使用webpack开发环境的最佳实践是什么。我不希望其他开发人员必须处理一个大bundle.js(猜测哪个文件和调试更难)。但是,我不想手动保留单个脚本src=。。。标签

  • 对于prod env,我不确定最好的方法是什么:

  • 或者是一些最佳实践,以避免webpack出现浏览器缓存问题

    多谢各位