Home  >  Article  >  Web Front-end  >  A brief discussion on how to configure @path alias in Angular10

A brief discussion on how to configure @path alias in Angular10

青灯夜游
青灯夜游forward
2021-03-16 09:38:541760browse

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.

A brief discussion on how to configure @path alias in Angular10

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

  • ##tsconfig.spec.json

    TSConfiguration for application testing

A brief discussion on how to configure @path alias in Angular10

The main configuration is in

tsconfig.base.json1, because in

The configuration of TS is introduced , add the field paths in compilerOptions to perform declaration mapping <pre class="brush:php;toolbar:false">{     &quot;compileOnSave&quot;: false,     &quot;compilerOptions&quot;: {         &quot;baseUrl&quot;: &quot;./&quot;,         &quot;outDir&quot;: &quot;./dist/out-tsc&quot;,         &quot;sourceMap&quot;: true,         &quot;declaration&quot;: false,         &quot;downlevelIteration&quot;: true,         &quot;experimentalDecorators&quot;: true,         &quot;moduleResolution&quot;: &quot;node&quot;,         &quot;importHelpers&quot;: true,         &quot;target&quot;: &quot;es2015&quot;,         &quot;module&quot;: &quot;es2020&quot;,         &quot;lib&quot;: [&quot;es2018&quot;, &quot;dom&quot;],         &quot;paths&quot;: {             &quot;@/*&quot;: [&quot;src/*&quot;]         }     } }</pre>2, and then use

@ /

is equivalent to using src/3 and using

@/

A brief discussion on how to configure @path alias in Angular104 , If

@/

A brief discussion on how to configure @path alias in Angular10

# is not used, the editor may throw an underline warning when using it after configuring it. If it is determined There is no problem with the configuration. You can try restarting the editor.

For more programming-related knowledge, please visit:

Programming Video

! !

The 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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete