Let ide identify alias of webpack


Many project scaffolds add an SRC directory by default@Aliases, when actually introduced into a project, can simplify the path, but it also brings a very troublesome problem:
The IDE cannot recognize these aliases, so it cannot automatically complete the path, cannot recognize the output of the reference resources, and has unnecessary alarms.

I stumbled across one of vscode’s web projectsjsconfig.jsonDocuments, such as:

  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    "target": "ES6",
    "module": "commonjs",
    "allowSyntheticDefaultImports": true
  "include": ["src/**/*"],
  "exclude": ["node_modules"]

As long as there is this file, vscode can recognize the alias normally.

Later, it was found that the ide of JetBrains home is simpler. You can specify the following configuration:

Let ide identify alias of webpack

In the web pack tab of project settings, point the configuration file to<projectRoot>/node_modules/@vue/cli-service/webpack.config.jsJust.

After saving and reopening the project, it is not onlysrc, all aliases likeutilsAnd so on can be recognized normally.

In fact, this has been written invue-cli3In the document of, but the original expression is not very intuitive, which has been ignored by me.

Recommended Today

The way of nonlinear optimization

Mathematical knowledge 1、 Nonlinear functionLinear function is another name of a function of first degree, then nonlinear function means that the function image is not a function of a straight line.Nonlinear functions include exponential function, power function, logarithmic function, polynomial function and so on. 2、 Taylor expansion1. Taylor formula:Taylor’s formula is to add a_ The […]