我正在使用配置 angularjs 项目依赖项requirejs
以下是配置
"cornerstone-core":"emp/cornerstone.min",
"cornerstone-math":"emp/cornerstoneMath.min",
"hammer":"emp/hammer.min",
"properties":"emp/properties"
"clientParameters":"emp/clientParameters"
"cornerstone":"emp/cornerstone"
"cornerstoneMath":"emp/cornerstoneMath"
"cornerstoneTools":"emp/cornerstoneTools"
"cornerstoneWADOImageLoaderCodecs":"emp/cornerstoneWADOImageLoaderCodecs"
"cornerstoneWADOImageWebWorker":"emp/cornerstoneWADOImageWebWorker"
"myApp":"emp/myApp"
运行时依赖项是,
clientParameters : [ "properties" ],
cornerstoneMath : [ "properties", "clientParameters", "cornerstone-core", "cornerstone-math", "hammerjs" ]
cornerstone : [ "properties", "clientParameters", "cornerstone-core", "cornerstone-math", "hammerjs" ],
cornerstoneTools : [ "properties", "clientParameters", "cornerstone-core", "cornerstone-math", "hammerjs" ],
myApp : [ "properties", "clientParameters", "cornerstone", "cornerstoneMath", "cornerstone-core", "cornerstone-math", "hammerjs" ]
在cornerstone.js 中,我以以下方式加载模块,
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("cornerstone", [], factory); // error line
else if(typeof exports === 'object')
exports["cornerstone"] = factory();
else
root["cornerstone"] = factory();
})(this, function() {
return (function(modules) {
我收到以下错误,
myApp.js:2312 Uncaught(in promise) ReferenceError: cornerstone is not defined
在define("cornerstone", [], factory);
我用一切替换错误行时,root["cornerstone"] = factory();
一切正常。
[编辑]
工厂方法是这个问题中使用的引导程序:尝试理解 Webpack