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
  • Merge requests
  • !6010

Add Cluster Module to Webpack node Configuration

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/knajcam/master into master Dec 10, 2018
  • Overview 4
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: knajcam

REASONING BEHIND CHANGES: The core module cluster is one of the node core librariers for in browser usage as described by the webpack dependency, node-libs-browser: cluster

It shows that the cluster module has no browser implementation and therefore in the node section of webpack.config it can have the property of 'empty', as done with dgram, fs, child_process etc. For users of create-react app with node.js code that requires cluster, they currently need to use a workaround to avoid ejecting and modifying the Webpack scripts on their own.

There are no side effects to this change, as adding cluster to the node section of the webpack config only affects users ability to run code originally written for the node.js environment in the browser, and as described above cluster has no browser or mock implementation and therefore can be marked as empty without any side effects.

VERIFICATION THAT CHANGES WORK: use case (code that uses log4js-node): before this change errors occurred due to log4js-node requiring the cluster module and Webpack not being able to find a module for it. cluster2 After adding cluster:'empty' to the webpack config, the code starts up as expected: cluster3

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/knajcam/master