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
  • !12578

Bugfix: Add missing .cjs extension to babel loader test in the webpack config

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/ldeninski/bugfix/add-missing-cjs-extension-to-webpack-config into main Jul 08, 2022
  • Overview 2
  • Commits 2
  • Pipelines 0
  • Changes 1

Created by: ldeninski

This PR adds the missed .cjs extension to the webpack config loader section. According to webpack docs found here to force the module type of a file you can use the .cjs extension similarly to .mjs for ESM. Without this extension explicitly added to the loader test rule, packages using .cjs file as a main in there package.json will not work at all. The index.cjs file is picked up by the file loader and treated as an asset. A good example of this behavior are all prosemirror packages witch are not usable in CRA app.

I tested my changes on a the codebase of a relatively complex project I am working on and the change is not breaking anything so far. Sorry but I cannot share screens from this project :)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/ldeninski/bugfix/add-missing-cjs-extension-to-webpack-config