Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack添加路径别名后,vscode不能智能提示,如何解决? #58

Open
artdong opened this issue May 8, 2020 · 1 comment
Labels
webpack 打包优化

Comments

@artdong
Copy link
Collaborator

artdong commented May 8, 2020

webpack添加路径别名后,vscode不能智能提示,如何解决?

@artdong
Copy link
Collaborator Author

artdong commented May 8, 2020

添加jsconfig.json文件

{
    "compilerOptions": {
      "baseUrl": "./",
      "paths": {
        "@app/*": ["app/*"],
        "@components/*": ["app/build/components/*"],
        "@common/*": ["app/build/common/*"],
        "@actions/*": ["app/build/actions/*"],
        "@enums/*": ["app/enums/*"],
        "@styles/*": ["app/build/style/*"]
      },
      "target": "ES6",
      "module": "commonjs",
      "jsx": "react",  // 重要!支持jsx文件,否则jsx文件无法跳转
      "allowSyntheticDefaultImports": true
    },
    "include": [
      "app/**/*"
    ],
    "exclude": ["node_modules"]
  }

注:

path 与 webpack配置的路径别名对应
jsx 支持jsx文件

@artdong artdong added the webpack 打包优化 label Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
webpack 打包优化
Projects
None yet
Development

No branches or pull requests

1 participant