0

我们有一个具有以下结构的多页应用程序:

ApplicationModule是包含所有应用程序逻辑模块的根文件夹,如Usermanagement和其他如下所示:

/应用程序模块/用户管理

//在userManagement文件夹中,我们有 html 页面及其对应的 .js(main) 文件 //所以我们有 login.htmllogin.js

Login.js反过来需要/加载执行页面逻辑所需的所有脚本文件,因此它的配置如下:

require.config({

paths: {
    'jquery': '../../Scripts/jquery',
    'appSessionManager': '../../Scripts/ApplicationSessionManager',
    'appBasePage': '../../Scripts/ApplicationBasePage',
    'initServices': '../../IntegrationServices/Eservices/EservicesUserManagementService/Authenticate',
    'smUtility': '../../Scripts/SmartServicesUtility',
}}); 

require(['appSessionManager', 'appBasePage', 'initServices', 'smUtility', 'jquery'], 
function    (sessionManagerRef, basePageRef, eservicesRef, utilityRef) 

{ 
$(document).ready(function () {
//Here is the page code that uses other libraries like appSessionManager, appBasePage and others.
});
});

现在,在投入生产之前,我们要使用优化器,以便将所有需要的文件连接起来并缩小为单个文件。

站在 UserManagement 文件夹中,我们为优化器运行以下命令: node ../../r.js -o name=Login out=optimize.js

但它给了我们以下错误:

跟踪依赖项:登录错误:ENOENT,没有这样的文件或目录 'D:[some application path]\ApplicationModules\UserManagement\appSession Manager.js' 在模块树中:登录

错误:错误:ENOENT,没有这样的文件或目录 'D:[some application path]\ApplicationModules\UserManagement\app SessionManager.js' 在模块树中:登录

at Object.fs.openSync (fs.js:427:18)

SessionManager.js文件的错误很明显,它试图在 usermangement 文件夹中找到它,但我希望它在 Scripts 文件夹中查找此文件,如login.js 文件的配置路径中所述。

如果有人能帮助我们解决这个问题,我将不胜感激。

4

0 回答 0