Home > Web Front-end > JS Tutorial > body text

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

青灯夜游
Release: 2021-03-16 09:38:54
forward
1815 people have browsed it

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 <div class="code" style="position:relative; padding:0px; margin:0px;"><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><div class="contentsignin">Copy after login</div></div>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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template