truffle-box / react-box

Truffle, Webpack and React boilerplate.
https://truffle-box.github.io/
MIT License
736 stars 251 forks source link

how to resolve the problem ? #87

Closed liwei00wade closed 5 years ago

liwei00wade commented 5 years ago

Module not found: You attempted to import ../../public/images/fail.gif which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.

adrianmcli commented 5 years ago

This is a problem with Create-React-App. Only imports from the src folder go through the Babel process. So when you require things outside of it, it will give you an error (i.e. just in case you require a JS file outside of the src folder, it will not get transformed).

You can actually disable this if you eject the project and change the webpack setting. More info here: https://stackoverflow.com/questions/44114436/the-create-react-app-imports-restriction-outside-of-src-directory

Will close this issue for now, thanks!