0

我有:

$ ls -last /home/brandon/workspace/ced2ar/jsgen/target/scala-2.12/scalajs-bundler/main/node_modules/bootstrap/dist/js/bootstrap.min.js
40 -rw-r--r-- 1 brandon brandon 37045 Jul 25  2016 /home/brandon/workspace/ced2ar/jsgen/target/scala-2.12/scalajs-bundler/main/node_modules/bootstrap/dist/js/bootstrap.min.js

@JSImport("node_modules/bootstrap/dist/js/bootstrap.min.js", "jQuery")

然而,当我运行 bundler 时,我收到以下错误:

[error] ModuleNotFoundError: Module not found: Error: Can't resolve 'node_modules/bootstrap/dist/js/bootstrap.min.js' in '/home/brandon/workspace/ced2ar/jsgen/target/scala-2.12/scalajs-bundler/main'
[error]     at factoryCallback (/home/brandon/workspace/ced2ar/jsgen/target/scala-2.12/scalajs-bundler/main/node_modules/webpack/lib/Compilation.js:269:40)

我也试过只使用文件bootstrap.min.js@JSImport。(注意:我认为一旦我解决了这个问题,我仍然会遇到处理猴子补丁的问题,因为这似乎是引导程序对 JQuery 所做的事情。)

4

1 回答 1

3

删除node_modules路径中的部分:

@JSImport("bootstrap/dist/js/bootstrap.min.js", "jQuery")

还要确保该文件与 CommonJS 兼容。

于 2017-12-21T22:00:06.870 回答