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

fix: disable esModule on file-loader and url-loader to fix require() issues

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/n3tr/disable-esmodule-to-file-loader into master Oct 28, 2020
  • Overview 8
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: n3tr

In https://github.com/facebook/create-react-app/pull/8950,

There is a breaking change in file-loader and url-loader (esModule enable by default). This causes require(..) returns an object instead of a string, and it will break projects that upgrade from v3 to v4.

This PR will disable esModule for those loaders to preserve the require behavior as in v3

Verify step

Both statements below should work.

const image = require('./lmage.png');
import image from './image.png';

I don't know if it is an intention to enable esModule in the loader or not. If so, we probably need to add it as a breaking break of v4 as well.


fix #9721, fix #9831

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/n3tr/disable-esmodule-to-file-loader