Webpack: expressing module dependency

后端 未结 2 1547
长发绾君心
长发绾君心 2021-01-31 18:09

I\'m trying to require the bootstrap-webpack module in my webpacked application.

It appears to need jQuery, since the bundled javascript then throws the fol

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 18:48

    Via this github issue.

    Install expose-loader and add require('expose?$!expose?jQuery!jquery'); to your main entry point just before you require webpack-bootstrap.

    This will set jQuery on the window so any file can get at it. Be careful with this method all files will then have access to that version of jQuery regardless of whether it was explicitly required.

提交回复
热议问题