0
到目前爲止,我的webpack dev服務器與我現有的一組依賴關係無任何問題。如何通過webpack加載bugsense.js?
現在我想在我的項目中使用bugsense
。 bugsense
庫不在npm存儲庫中。
這是我包括在我的package.json
"dependencies": {
"bootstrap": "^3.3.6",
"bugsense": "bugsense/bugsense.js",
...
將包裝從GitHub下載的預期。
然而,當我試圖將其導入一個ES6 js腳本,像這樣
import bugsense from 'bugsense';
我得到了這些錯誤消息
Module not found: Error: Cannot resolve module 'bugsense' in /Users/antkong/dev/projects/web/app/scripts/actions
resolve module bugsense in /Users/antkong/dev/projects/web/app/scripts/actions
looking for modules in /Users/antkong/dev/projects/webview/node_modules
/Users/antkong/dev/projects/webview/node_modules/bugsense doesn't exist (module as directory)
resolve 'file' bugsense in /Users/antkong/dev/projects/webview/node_modules
resolve file
/Users/antkong/dev/projects/webview/node_modules/bugsense doesn't exist
/Users/antkong/dev/projects/webview/node_modules/bugsense.webpack.js doesn't exist
/Users/antkong/dev/projects/webview/node_modules/bugsense.web.js doesn't exist
/Users/antkong/dev/projects/webview/node_modules/bugsense.js doesn't exist
/Users/antkong/dev/projects/webview/node_modules/bugsense.json doesn't exist
looking for modules in /Users/antkong/dev/projects/web/node_modules
resolve 'file' bugsense in /Users/antkong/dev/projects/web/node_modules
resolve file
/Users/antkong/dev/projects/web/node_modules/bugsense is not a file
/Users/antkong/dev/projects/web/node_modules/bugsense.webpack.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense.web.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense.json doesn't exist
resolve 'file' or 'directory' /Users/antkong/dev/projects/web/node_modules/bugsense
resolve file
/Users/antkong/dev/projects/web/node_modules/bugsense is not a file
/Users/antkong/dev/projects/web/node_modules/bugsense.webpack.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense.web.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense.json doesn't exist
resolve directory
directory default file index
resolve file index in /Users/antkong/dev/projects/web/node_modules/bugsense
/Users/antkong/dev/projects/web/node_modules/bugsense/index doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/index.webpack.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/index.web.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/index.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/index.json doesn't exist
use ./lib/node/index.js from package.json
resolve 'file' or 'directory' ./lib/node/index.js in /Users/antkong/dev/projects/web/node_modules/bugsense
resolve file
/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.webpack.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.web.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.js doesn't exist
/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.json doesn't exist
resolve directory
/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js doesn't exist (directory default file)
/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js/package.json doesn't exist (directory description file)
[/Users/antkong/dev/projects/web/node_modules/bugsense.webpack.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense.webpack.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense.web.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense.web.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense.json]
[/Users/antkong/dev/projects/web/node_modules/bugsense.json]
[/Users/antkong/dev/projects/webview/node_modules/bugsense]
[/Users/antkong/dev/projects/webview/node_modules/bugsense]
[/Users/antkong/dev/projects/webview/node_modules/bugsense.webpack.js]
[/Users/antkong/dev/projects/webview/node_modules/bugsense.web.js]
[/Users/antkong/dev/projects/webview/node_modules/bugsense.js]
[/Users/antkong/dev/projects/webview/node_modules/bugsense.json]
[/Users/antkong/dev/projects/web/node_modules/bugsense/index]
[/Users/antkong/dev/projects/web/node_modules/bugsense/index.webpack.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense/index.web.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense/index.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense/index.json]
[/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.webpack.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.web.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.js]
[/Users/antkong/dev/projects/web/node_modules/bugsense/lib/node/index.js.json]
@ ./app/scripts/actions/someActions.js 21:16-35
的WebPack無法加載模塊由於丟失的文件。
我該如何解決?我可以簡單地通過一些webpack配置修復它嗎?