React-boilerplate: a newbie question about include paths

Created on 15 Sep 2016  路  3Comments  路  Source: react-boilerplate/react-boilerplate

Please forgive me if this question has already been answered.
In the boilerplate app/containers/HomePage/sagas.js:

we have:

import { LOAD_REPOS } from 'containers/App/constants';
import { reposLoaded, repoLoadingError } from 'containers/App/actions';

But when I create my own containers, with sagas, and try to the same include statements,
I get:

ERROR in ./app/containers/PageSinglePost/sagas.js Module not found: Error: Can't resolve 'containers/App/constants'

Is there something like an include path that is being set somewhere?
How is it possible that HomePage is able to do an import, specifying 'containers/App/NameOfSomeContainer' instead of '../App/NameOfSomeContainer'? How does it know implicitly to look inside /app/ ?

Most helpful comment

You answered my question; correctly diagnosed the cause of my error, and made poignant and helpful recommendations about where to go next. Triple Thanks!!!

All 3 comments

Is there something like an include path that is being set somewhere?

Hi @arthurCormack, There is 'something like an include path'. It can be found in /internals/webpack/webpack.base.babel/js at line 83:

  resolve: {
    modules: ['app', 'node_modules'],

But this is not anything you would need to change in the normal course of development. This makes imports like import { LOAD_REPOS } from 'containers/App/constants'; 'just work' without having to consider the import path e.g. import { LOAD_REPOS } from '../../containers/App/constants';

So, the reason for the error must be something else.

I'm guessing that you have done something like: run npm run clean and then copied from containers/HomePage/sagas.js from before the clean?

The problem here might be that containers/App/constants does not actually exist. It, and actions, among others, are removed by npm run clean.

Assuming that is the source of your problem, may I recommend that you spend some time studying the docs and the example code before starting out with a "clean" project.

Also, see this Smashing Mag article where @mxstbr discusses some of the tech used in react-boilerplate. You may also find his book on React of value.

You answered my question; correctly diagnosed the cause of my error, and made poignant and helpful recommendations about where to go next. Triple Thanks!!!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kunal-mandalia picture kunal-mandalia  路  4Comments

joehua87 picture joehua87  路  3Comments

williamgranli picture williamgranli  路  3Comments

zamrq picture zamrq  路  3Comments

smiile picture smiile  路  3Comments