我在/Scripts/ShiftPlan/test.tsx中有React组件,它看起来像这样:
import React = require('react');
const test: React.StatelessComponent<React.HTMLProps<JSX.Element>> = () =>
<div>
Test component
</div>
export = () => React.createElement(test, {})
和我的tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"baseUrl": "./",
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"outFile": "site.js",
"jsx": "react",
"module": "amd",
"typeRoots": [ "../node_modules/@types/**/" ]
},
"exclude": [
"node_modules",
"wwwroot",
"typings",
"Tests"
],
"include": [ "./**/*.tsx", "./**/*.ts" ]
}
问题是我的测试组件将编译成site.js,如下所示:
define("test", ["require", "exports", "react"], function (require, exports, React) {
"use strict";
var test = function () {
return React.createElement("div", null, "sadsad");
};
return function () { return React.createElement(test, {}); };
});
但是它应该
define("ShiftPlan/test"....
非常感谢任何建议。