My React application requires using the root directory of my JS file using Webpack resolve.root . That is, my file structure contains the following:
components App.react.js containers AppContainer.react.js
In AppContainer.react.js, I have:
import App from 'components/App.react';
This works on the client side. Now I'm trying to make it isomorphic. If I need AppContainer.react.js in my server.js, it says components/App.react not found. Node is trying to require containers/components/App.react.js , which does not exist. How can I make Node require relative to a given directory?
Edit: my directory structure looks like this:
css/ html/ js/ components/ App.react.js containers/ AppContainer.react.js main.js <- requires AppContainer public/ server/ server.js <- requires AppContainer
Leo jiang
source share