A
A
Andrey Astafiev2019-12-06 17:56:52
React
Andrey Astafiev, 2019-12-06 17:56:52

How to make a shortcut to a folder in react?

Tired of specifying a long path to the folder all the time example: './.../.../../components'
how to make it just to specify 'components'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Petr Muhurov, 2019-12-06
@pterodaktil

webpack.config.js

resolve: {
    alias: {
      components: path.resolve(__dirname, "./src/components")
    }
  }

V
Vladimir Korotenko, 2019-12-06
@firedragon

Use the absolute path
https://medium.com/@ktruong008/absolute-imports-wi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question