作者:四季汤料_788 | 来源:互联网 | 2023-05-18 14:00
Iamconfiguringangularjsprojectdependeciesusingrequirejs我正在使用requirejs配置angularjs项目依赖项follo
I am configuring angularjs project dependecies using requirejs
我正在使用requirejs配置angularjs项目依赖项
following are the configurations
以下是配置
"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"
Runtime dependencies are,
运行时依赖项是,
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" ]
In cornerstone.js I am loading the modules in a following way,
在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) {
I am getting the following error,
myApp.js:2312 Uncaught(in promise) ReferenceError: cornerstone is not defined
我收到以下错误,myApp.js:2312未捕获(在承诺中)ReferenceError:未定义基石
at line define("cornerstone", [], factory);
when I am replacing the error line with root["cornerstone"] = factory();
everything is working fine.
在线定义(“基石”,[],工厂);当我用root [“cornerstone”] = factory()替换错误行时一切都很好。
[EDIT]
factory method is bootstrapper used in this question: Trying to understand Webpack
[编辑]工厂方法是在这个问题中使用的bootstrapper:试图理解Webpack
1 个解决方案