通常我们会使用一些地方模块在我们的项目中,比如bootstrap

import 'bootstrap'

 

导入的bootstrap默认会查找当前目录的node_modules文件,但是如果这个文件没有,会依次往上级模块查找,直到到C盘的根目录为止,可以通过webpack配置来限制查找的目录

  resolve: {
    modules: [path.resolve('node_modules')], // 第三方模块我们只找当前目录的node_modules
  }

 

这是我们的优化方案哦

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-01-24
  • 2021-12-06
  • 2022-01-27
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
相关资源
相似解决方案