DEV Community

Discussion on: How Pros Get Rid of Relative Imports

 
ruppysuppy profile image
Tapajyoti Bose

Add the following in webpack.config.js:

module.exports = {
    // ...
    resolve: {
        alias: {
            // path to your models
            '@models': path.resolve(__dirname, './src/models'),
        },
    }
}
Enter fullscreen mode Exit fullscreen mode

Use yarn eject first if you are using create-react-app

Thread Thread
 
talorlanczyk profile image
TalOrlanczyk

Thanks,
But when i say you can't meant that you must do an additional step like eject to do this or use third party library
I think add this to your article will great for a lot of developers