Webpack“解决”function是否可以解决AMD样式的path定义?

我想在这里得到一个非常简单的概念validation…我有一个使用AMD的js库,但是我需要依赖来parsingnode_modules。 所以我有以下几点:

webpack.config.js

module.exports = { entry: "./resources/content/scripts/twitter_module", output: { path: path.join(__dirname, "build"), filename: "out.js", }, resolve: { root: __dirname, modulesDirectories: [ path.join(__dirname, "node_modules") ] } }; 

这是我从webpack得到的输出:

 Hash: bab530b56faec6755978 Version: webpack 1.8.2 Time: 49ms Asset Size Chunks Chunk Names out.js 8.6 kB 0 [emitted] main [0] ./resources/content/scripts/twitter_module.js 6.44 kB {0} [built] [3 errors] ERROR in ./resources/content/scripts/twitter_module.js Module not found: Error: Cannot resolve module 'vendor.asset.jquery/jquery' in /Users/bob/projects/repository/resources/content/scripts @ ./resources/content/scripts/twitter_module.js 3:0-198:2 ERROR in ./resources/content/scripts/twitter_module.js Module not found: Error: Cannot resolve module 'vendor.asset.jquery/jquery.ie.cors' in /Users/bob/projects/repository/resources/content/scripts @ ./resources/content/scripts/twitter_module.js 3:0-198:2 ERROR in ./resources/content/scripts/twitter_module.js Module not found: Error: Cannot resolve module 'vendor.asset.moment/moment' in /Users/bob/projects/repository/resources/content/scripts @ ./resources/content/scripts/twitter_module.js 3:0-198:2 

输出表明parsingconfiguration没有被使用/应用。 它仍然在寻找模块的同一目录中的脚本,试图导入它们。 解决只为common.js工作需要? 我所阅读的文档和示例中的每一件事似乎都表明这应该起作用。

包括目录结构:

 ➜ repository pwd /Users/bob/projects/repository ➜ repository ls resources/content/scripts/twitter_module.js resources/content/scripts/twitter_module.js 

这些供应商软件包中存在外部依赖关系:

 ➜ repository ls vendor.asset.jquery/content/scripts/jquery.js vendor.asset.moment/content/scripts/jquery.js ➜ repository ls vendor.asset.moment/content/scripts/moment.js vendor.asset.moment/content/scripts/moment.js 

所以我遇到的问题是,看起来Webpack日志输出有点误导。 当你有多个“解决”的位置,似乎webpack只报告当前目录作为缺失的依赖关系的位置,尽pipesearch其他path和在解决configuration中定义的根path。 如果你有一个path问题,例如你的根parsingpath,webpack并不表示它试图在那里。