Unable to import JSON file in symlinked dependency
Created by: iameli
Description
I've created a reproduction repro here.
You can use create-react-app to import JSON files just fine require("./file.json")
. This works just fine if the JSON file is within the create-react-app project's folder.
This behavior doesn't work, however, if the file being imported is a symlinked dependency in node_modules
. Webpack (or whatever) complains Module not found: 'json'
.
I first ran into the problem with a dependency that had been symlinked by Lerna.
The repro I submitted automatically creates a symlinked dependency in a postinstall
script.
Expected behavior
I should import the JSON file.
Actual behavior
Failed to compile.
Error in ../demo-dependency/index.js
Module not found: 'json' in /Users/eli/code/json-bug/demo-dependency
@ ../demo-dependency/index.js 2:13-35
Environment
Run these commands in the project folder and fill in their results:
> npm ls react-scripts
demo-app@0.1.0 /Users/eli/code/json-bug/demo-app
└── react-scripts@0.9.5
> node -v
v7.5.0
> npm -v
4.4.4
Operating system: macOS 10.11.3 Browser and version: n/a, compilation error