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
webpack配置路径别名
The text was updated successfully, but these errors were encountered:
模块化开发项目中,比如vue和react等,经常需要import不同的js或者css模块到当前目录,那么如果路径比较深的话使用相对路径就比较麻烦,而且在文件迁移的时候,如果在不同的目录下边,又得改变以下引入的路径。所以我们可以使用webpack配置路径别名,在引入的时候我们直接使用这个别名,就可以正确的指向。
在webpack.config.dev中的resolve下的alias属性做以下配置:
alias: { "@src":path.resolve("src"), "@components":path.resolve("src/components"), "@pages":path.resolve("src/pages"), "@utils":path.resolve("src/utils"), },
import Home from "@pages/home/home" import userForm from '@components/form/user/user_form.jsx';
Sorry, something went wrong.
No branches or pull requests
webpack配置路径别名
The text was updated successfully, but these errors were encountered: