Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a reproduction for module rules not applying to a resource added by a plugin #18065

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ezzatron
Copy link

@ezzatron ezzatron commented Feb 7, 2024

This PR is trying to demonstrate a reproduction of the issue described in #17747, so that we can try to find a fix that doesn't also add a regression for #16466.

I'm submitting a draft PR, because it makes no sense to merge until a fix is found.

What kind of change does this PR introduce?

This PR adds a new statsCases test case, that when run, currently produces an error like:

$ yarn jest StatsTestCases -t issue-17747
yarn run v1.22.19
$ node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage StatsTestCases -t issue-17747
 FAIL  test/StatsTestCases.basictest.js (50 MB heap size)
  warmup
    ○ skipped should warmup webpack
  StatsTestCases
    ✕ should print correct stats for issue-17747 (210 ms)

...(snip)...

  ● StatsTestCases › should print correct stats for issue-17747

    Child compilation failed:
    Module parse failed: Unexpected token (1:8)
    File was processed with these loaders:
     * ./loader.js
    You may need an additional loader to handle the result of these loaders.
    > {"asset":"3ee037f347c64cc372ad.txt"}:
    SyntaxError: Unexpected token (1:8)

      39 |           .join("\n");
      40 |
    > 41 |         throw new Error(`Child compilation failed:\n${errorDetails}`);
         |               ^
      42 |       }
      43 |     }
      44 |   };

      at handleMake (test/statsCases/issue-17747/plugin.js:41:15)

...(snip)...

You can also demonstrate that this test passes if you comment out the following lines from NormalModuleFactory.js:

if (r.type === "type" && noPrePostAutoLoaders) {
continue;
}

This PR also includes the snapshot that's generated when you run the test with these lines commented out.

Did you add tests for your changes?

This PR only contains tests, no implementation changes.

Does this PR introduce a breaking change?

No.

What needs to be documented once your changes are merged?

Documentation is unaffected.

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

Copy link

linux-foundation-easycla bot commented Feb 7, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: ezzatron / name: Erin (b6afa32)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants