我正在使用一个名为 module-alias 的 npm 模块。我在 tsconfig.json 和 package.json 中映射一些模块
\n\ntsconfig.json
\n\n"compilerOptions": {\n "baseUrl": "./src",\n "paths": {\n "@config/*": ["config/*"],\n "@interfaces/*": ["interfaces/*"],\n "@services/*": ["services/*"]\n },\n "module": "commonjs",\n "target": "es2015", /* Specify module code generation: \'none\', \'commonjs\', \'amd\', \'system\', \'umd\', \'es2015\', or \'ESNext\'. */\n "sourceMap": true,\n "outDir": "./dist", /* Redirect output structure to the directory. */\n "rootDir": "./src", \n "allowSyntheticDefaultImports": true /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */\n}\nRun Code Online (Sandbox Code Playgroud)\n\n包.json …
我正在遵循《英雄之旅》教程来构建我的第一个应用程序,我编写了一个组件文件threads.component.ts,如下所示:
@Component({
moduleId: module.id,
selector: 'Threads',
templateUrl: './threads.component.html',
styleUrls: ['./threads.component.css']
})
Run Code Online (Sandbox Code Playgroud)
但出现错误“找不到名称模块”,该怎么办才能解决此问题?