我有这个文件
路由.ts
class RouteConfig {
// Some implementation
}
我这样使用
app.module.ts
angular.module("ApplicationsApp", [
"ApplicationsApp.Services",
"ApplicationsApp.Clients",
"ApplicationsApp.Application"])
.config(RouteConfig);
然后我使用导入之前的两个文件
索引.ts
import "./scripts/routing.ts";
import "./scripts/app.module.ts"";
我正在使用webpack
andts-loader
并且index.ts
是入口点之一。构建成功,但是当我运行它时出现此错误
app.module.ts:5 Uncaught ReferenceError: RouteConfig is not defined
at Object.<anonymous> (app.module.ts:5)
at __webpack_require__ (bootstrap 755a82fd7c11e301b6c1:676)
at fn (bootstrap 755a82fd7c11e301b6c1:87)
at Object.<anonymous> (index.ts:4)
at __webpack_require__ (bootstrap 755a82fd7c11e301b6c1:676)
at fn (bootstrap 755a82fd7c11e301b6c1:87)
at Object.defineProperty.value (events.js:302)
at __webpack_require__ (bootstrap 755a82fd7c11e301b6c1:676)
at logLevel (bootstrap 755a82fd7c11e301b6c1:722)
at main.min.js:726
我给的配置ts-loader
看起来像
{
configFile: paths.resolveOwn('config/tsconfig.json'),
compilerOptions: {
target: 'ES5',
module: 'commonjs',
moduleResolution: 'node',
sourceMap: true,
strict: true,
typeRoots: [
paths.resolveOwn('node_modules/@types'),
paths.resolveApp('node_modules/@types')
]
}
}
你知道我做错了什么吗?我查看了几乎所有tsconfig.json
选项,但找不到解决我问题的选项