Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #1895
Closed
Open
Issue created Mar 26, 2017 by Administrator@rootContributor

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

Reproducible Demo

https://github.com/iameli/create-react-app-json-bug

Assignee
Assign to
Time tracking