Create-react-app: Allow importing assets from parent folder

Created on 26 Aug 2016  路  3Comments  路  Source: facebook/create-react-app

The app we are building with create-react-app is a part of a larger application, and resides in a subfolder of the repository. We wanted to load some JSON files from the parent folder, so we don't need to copy these configurations (used also by other parts of the app) to the subfolder.

Currently this results in an error, because files from the parent folder are not loaded with json-loader:

You may need an appropriate loader to handle this file type.

Would it make sense to loosen the include setting for certain loaders? We probably still want to exclude node_modules from the modules processed with babel-loader, but wouldn't it make sense to drop the include setting altogether from those loaders that already have include: [paths.appSrc, paths.appNodeModules]?

Most helpful comment

@fson @gaearon what about importing js modules from a parent shared folder, is that possible?

All 3 comments

wouldn't it make sense to drop the include setting altogether from those loaders that already have include: [paths.appSrc, paths.appNodeModules]?

Let's do it. Want to send a PR?

@gaearon I'll send a PR.

@fson @gaearon what about importing js modules from a parent shared folder, is that possible?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aranir picture Aranir  路  3Comments

wereHamster picture wereHamster  路  3Comments

AlexeyRyashencev picture AlexeyRyashencev  路  3Comments

alleroux picture alleroux  路  3Comments

alleroux picture alleroux  路  3Comments