Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • !12352

fix: exclude CJS files with file loader (#11889)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/gdethier/main into main 3 years ago
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: gdethier

This PR fixes #11889. The change has been tested against the code example provided in the issue:

  1. Download the code example
  2. Install dependencies
  3. Eject
  4. Apply the config change described in this PR
  5. Run the app and see that it works as expected. Capture d’écran du 2022-05-02 15-51-31

Without the change, one would get this instead: Capture d’écran du 2022-05-02 15-52-26

Compare
  • version 1
    814dc64a
    2 years ago

  • main (HEAD)

and
  • latest version
    814dc64a
    1 commit, 2 years ago

  • version 1
    814dc64a
    1 commit, 2 years ago

1 file
+ 6
- 1

    Preferences

    File browser
    Compare changes
packages/react-scripts/config/webpack.config.js
+ 6
- 1
  • View file @ 8377ee80

  • Edit in single-file editor

  • Open in Web IDE


@@ -594,7 +594,12 @@ module.exports = function (webpackEnv) {
@@ -594,7 +594,12 @@ module.exports = function (webpackEnv) {
// its runtime that would otherwise be processed through "file" loader.
// its runtime that would otherwise be processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
// by webpacks internal loaders.
exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
exclude: [
 
/^$/,
 
/\.(js|mjs|jsx|ts|tsx|cjs)$/,
 
/\.html$/,
 
/\.json$/,
 
],
type: 'asset/resource',
type: 'asset/resource',
},
},
// ** STOP ** Are you adding a new loader?
// ** STOP ** Are you adding a new loader?
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: http-party/node-http-proxy!388
Source branch: github/fork/gdethier/main

Menu

Explore Projects Groups Snippets