We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
你好,我按照文中所述分别设置了paths,alias,tsconfig后依然无法使用别名。。 paths.js: componentPath: resolveApp('src/app/components') tsconfig.json: "baseUrl": "src", "paths": { "src/*":["src/*"], "components/*":["src/app/components/*"] }, webpack.config.js 'components': paths.componentPath
componentPath: resolveApp('src/app/components')
"baseUrl": "src", "paths": { "src/*":["src/*"], "components/*":["src/app/components/*"] },
'components': paths.componentPath
报错: Cannot find module 'components/home/index'. TS2307
The text was updated successfully, but these errors were encountered:
我发现了 那个baseUrl 我设置的时候提示我只能写'src'或者'node_modules' 于是我写了个'src' 你的配置中写的是'.' 我改成'.' 成功了 这是什么原理?
Sorry, something went wrong.
最新版create-react-app是推荐写src的,并且已经不需要在webpack.config.js中配置alias,直接在tsconfig中配置即可,新版的reactc li将tsconfig中的baseurl添加到了resolve.modules中。建议按照新版create-react-app的要求将本项目的baseurl写成src,那么tsconfig以及alias也要相应的改变。
已经完善别名配置笔记,ts项目无需在alias中添加别名配置,在tsconfig中写即可
No branches or pull requests
你好,我按照文中所述分别设置了paths,alias,tsconfig后依然无法使用别名。。
paths.js:
componentPath: resolveApp('src/app/components')
tsconfig.json:
"baseUrl": "src", "paths": { "src/*":["src/*"], "components/*":["src/app/components/*"] },
webpack.config.js
'components': paths.componentPath
报错:
Cannot find module 'components/home/index'. TS2307
The text was updated successfully, but these errors were encountered: