无法使用RequireOptimizer合并文件

时间:2014-01-15 11:32:32

标签: requirejs build-process

我想使用Require Optimizer合并文件,由于错误我无法做到这一点:

这是文件夹结构:

-build
  -r.js
  -build.js
-server
  -app.js
  -src
    -clientConnectivity
      -Upload.js

这是build.js

({
    baseUrl: "..",
    paths: {
        uploadManager: "./server/src/clientConnectivity/Upload"
    },
    include: uploadManager,
    name: "server/app",
    out: "main-built.js"
})

这是传递的命令和收到的错误:

C:\Users\Anjan\WebstormProjects\RequireOptimizerTest\build>node r.js -o build.js
Error: Error: Build file C:/Users/Anjan/WebstormProjects/RequireOptimizerTest/build/build.js is malformed: ReferenceError: uploadManager is not defined
    at Function.build.createConfig (C:\Users\Anjan\WebstormProjects\RequireOptimizerTest\build\r.js:26541:23)

这是app.js中的导入。我希望Require Optimizer在app.js中读取这些导入,并相应地合并调用的文件。

import express = require('express');
import http = require('http');
import path = require('path');
import fs = require('fs');
import uploadModule = require('./src/clientConnectivity/Upload');

1 个答案:

答案 0 :(得分:0)

这是一个固定的例子:

({
    baseUrl: "..",
    name: "server/app",
    out: "main-built.js",
    mainConfigFile : 'path/to/main.js',
    findNestedDependencies: true
})