怎么来兼容老式jQuery插件

ProvidePlugin + expose-loader / externals

1.ProvidePlugin + expose-loader

webpack.config.js中在plugins中配置

webpack打包jQuery,jQuery未定义

webpack.config.js中在module中配置

webpack打包jQuery,jQuery未定义

2.externals

webpack.config.js中配置externals

webpack打包jQuery,jQuery未定义

 

 注意:两者选择其中一种即可,两种都使用依旧会报错。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-05-23
  • 2022-12-23
猜你喜欢
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2022-01-01
  • 2021-12-24
  • 2021-09-13
相关资源
相似解决方案