0

我可能做错了什么,所以请随意质疑所有事情。我将 npm 包 xrm-mock 用于 MS CRM 模拟框架。我已经这样设置了我的配置

steal.config({
    meta: {
        "dependencyModule": {
            deps: [
                /***********************************
                 *  List of Spec Files goes here!  *
                 ***********************************/
                "spec/po_/commonSpec"
                ,"spec/xrmMockGeneratorSpec"
            ]
        },
        "jasmine": {
            "exports":  "jasmineRequire"
        },
        "jasmine-html": {
            deps: ["jasmine"]
        },
        "jasmine-boot": {
            deps: ["jasmine", "jasmine-html"]
        },
        "xrm-mock-generator": {
            deps: ["xrm-mock"]
        }
    },
    bundlesPath: "../WebResources",
    loadBundles: true,
    paths: {
        "jasmine": "../node_modules/jasmine-core/lib/jasmine-core/jasmine.js",
        "jasmine-html": "../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js",
        "jasmine-boot": "../node_modules/jasmine-core/lib/jasmine-core/boot.js",
        "sourcemapped-stacktrace": "../node_modules/sourcemapped-stacktrace/dist/sourcemapped-stacktrace.js",
        "xrm-mock": "../node_modules/xrm-mock/index.js",
        "xrm-mock-generator": "../node_modules/xrm-mock-generator/dist/xrm-mock-generator.js"
    },
    map: {},
    main: "./testRunner"
});

但 xrm-mock/index.js 看起来像这样:

"use strict";
exports.__esModule = true;
var formselector_mock_1 = require("./dist/page/formselector/formselector.mock");
exports.FormSelectorMock = formselector_mock_1.FormSelectorMock;
var formitem_mock_1 = require("./dist/page/formitem/formitem.mock");
exports.FormItemMock = formitem_mock_1.FormItemMock;
   ... 80 more lines...

我为每个要求得到 404:"http://localhost:62576/test/dist/page/formselector/formselector.mock.js"应该是"http://localhost:62576/node_modules/xrm-mock/dist/page/formselector/formselector.mock.js"

我猜我可以将每个模块文件添加为带有路径的模块,但这是我必须定义的 40 个模块。有没有更简单的方法?

4

1 回答 1

2

现在大多数开发者都使用 npm 插件,你知道吗?消除了对这个手动(和困难)配置的需要虽然要回答你的问题,我认为你想要做的是删除 xrm-mock 路径,而是有类似的东西

"xrm-mock/*": "../node_modules/xrm-mock/*.js"

然后是主模块的地图:

"map": {
  "xrm-mock": "xrm-mock/index"
}
于 2018-03-22T15:01:49.003 回答