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
  • #6277
Closed
Open
Issue created Jan 25, 2019 by Administrator@rootContributor

Add Node DNS as a Webpack mock - PR Linked

Created by: Downchuck

Presently CRA works quite well for isomorphic web applications: I've only hit one strong issue -- node built-ins as required by submodules. So when I hit: "Module not found: Can't resolve 'dns'" with my yarn start, I was unable to work around it, short of manually editing a node module (a pain).

Several libraries have worked to remove dns from their require statements. This issue bubbled from node-postgres, which has a direct require('dns') statement that I've had to comment out. With that done, life just works, for a rather large and complicated, multiple component application.

Unfortunately, I've not found another route.

I attempted to add a stub for dns in package.json, but as "pg" is included from the sub-project, I was unable to work-around the issue. As I'm using serve and build, not test, I don't have Jest mocks to fall back on.

I am doing all I can not to run an eject, as I'd like to stay simple and with the mainline of CRA.

So with all of that said, I'm looking/asking if there is a method for accommodating the peculiar use case of dependencies that have calls to node built-ins, such that they do not break the build.

Obviously I am not asking that we actually make them work -- once the build runs I have no issue mocking those libraries to take different routes.

Assignee
Assign to
Time tracking