应该在Angular中指向文件的短路径吗?

问题描述 投票:0回答:1

在某些我导入的CSS文件中:

@import "../../../theme.scss"
@import "../../theme.scss"
@import "../../../../../../theme.scss"
@import "../theme.scss"

我应该配置为在所有情况下都使用此功能:

@import "theme.scss"
angular angular5 angular8
1个回答
0
投票

您可以通过将其添加到tsconfig.json {compilerOptions:{path:HERE !!}}]中进行设置>

"paths": {
  "core-js/es7/reflect": ["node_modules/core-js/proposals/reflect-metadata"],
  "core-js/es6/*": ["node_modules/core-js/es/*"],
  "@swagger/*": ["src/app/_swagger/*"],
  "@swagger": ["src/app/_swagger/index.ts"],
  "@directives/*": ["src/app/_directives/*"],
  "@services/*": ["src/app/_services/*"],
  "@models/*": ["src/app/_models/*"],
  "@tables/*": ["src/app/tables/*"],
  "@tables_services/*": ["src/app/tables/services/*"],
  "@shared/*": ["src/app/shared/*"],
  "@language/*": ["src/app/_language/*"],
  "moment": [
    "node_modules/moment/min/moment.min.js"
  ]
}
© www.soinside.com 2019 - 2024. All rights reserved.