V
V
vljs2018-04-20 15:03:56
JavaScript
vljs, 2018-04-20 15:03:56

How to make webpack find files outside of folders?

I'm trying to reach out from a component that is three levels below the tree, but the browser swears that the required file is not there.
Tree:
components/catalog/DesiredComponent.js
components/ui/nav/I'mHere.js Tried many options with two dots, slashes, etc. The result hasn't changed. babel-loader is present. What could be the problem?
import НужныйКомпонент from '.../catalog';

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vljs, 2018-04-22
@vljs

All we had to do was change the destination. Let's say if the file is two levels ahead.
'.../catalog' ---> '../../catalog'

L
Lynn "Coffee Man", 2018-04-20
@Lynn

import RequiredComponent from '../../catalog/RequiredComponent.js'
Or install some plugin that can guess the file name from import.
Or create an index.js file in the catalog folder that will export the components.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question