https://github.com/Urigo/angular-meteor/tree/master/atmosphere-packages/angular-compilers
我在paths
中使用了tsconfig.json
编译器选项,以缩短导入路径,但是似乎编译器在编译期间无法解析模块路径。可以在angular-compilers
中设置别名路径吗?
我认为我的paths
的非相对模块路径不正确,如何正确设置?
P.S。在VS代码中,没有错误:v
导入语法
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { Meteor } from 'meteor/meteor';
import { AppModule } from '~/client/core/app.module';
tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"allowSyntheticDefaultImports": true,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"inlineSourceMap": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"sourceMap": true,
"stripInternal": true,
"lib": ["dom", "es2015", "scripthost"],
"paths": {
"*": ["node_modules/*", "src/types/*"],
"~/*": ["src/*"]
},
"typeRoots": ["node_modules/@types", "src/types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "src/**/*.spec.ts"],
"compileOnSave": false
}
输出错误
/.meteor/packages/meteor-tool/.1.7.0_3.o37tid.7k2h++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
throw(ex);
^
Error: Cannot find module '/node_modules/@angular/core/core'
at makeMissingError (packages/modules-runtime.js:208:12)
at Module.require (packages/modules-runtime.js:227:17)
at require (packages/modules-runtime.js:244:21)
at email-toolbar.js (src/both/classes/email-toolbar.ts:1:1)
at fileEvaluate (packages/modules-runtime.js:322:7)
at Module.require (packages/modules-runtime.js:224:14)
at require (packages/modules-runtime.js:244:21)
at src/server/main.ts:12:2
at ...
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.