This article will introduce to you how to configure @path alias in Angular10. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Related recommendations: "angular Tutorial"
Configuration in Angular10
@ Path alias
Project file structure in Angular10
中文网站
## in Angular10
##tsconfigThe configuration is divided into four files
tsconfig.jsonThe default
TSP configuration for each project in the workspace
tsconfig.base.jsonThe base
TS configuration used by all projects in the workspace, all other configuration files are inherited from this Basic file
tsconfig.app.json Application-specific
TS configuration includes
TS and
AngularOptions for the template compiler
TS
Configuration for application testing
tsconfig.base.json1, because in
The configuration of TS is introduced , add the field
paths in compilerOptions
to perform declaration mapping <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": ["es2018", "dom"],
"paths": {
"@/*": ["src/*"]
}
}
}</pre><div class="contentsignin">Copy after login</div></div>
2, and then use
is equivalent to using src/
3 and using
4 , If
@/For more programming-related knowledge, please visit:
Programming VideoThe above is the detailed content of A brief discussion on how to configure @path alias in Angular10. For more information, please follow other related articles on the PHP Chinese website!