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

[Bug]: NormalModule getCompilationHooks loader Plugin Not Working #9514

Open
kkaaddff opened this issue Feb 28, 2025 · 0 comments
Open

[Bug]: NormalModule getCompilationHooks loader Plugin Not Working #9514

kkaaddff opened this issue Feb 28, 2025 · 0 comments
Labels
pending triage The issue/PR is currently untouched.

Comments

@kkaaddff
Copy link

System Info

System:
OS: macOS 15.3.1
CPU: (8) arm64 Apple M1 Pro
Memory: 174.50 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.20.0 - ~/.local/state/fnm_multishells/42940_1740730866904/bin/node
Yarn: 1.22.22 - ~/.local/state/fnm_multishells/42940_1740730866904/bin/yarn
npm: 10.5.0 - ~/.local/state/fnm_multishells/42940_1740730866904/bin/npm
pnpm: 9.15.4 - ~/.local/state/fnm_multishells/42940_1740730866904/bin/pnpm
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 133.0.6943.142
Edge: 133.0.3065.82
Safari: 18.3

Details

I’m trying to create a custom plugin, but it’s not working as expected. Here’s the code I’m using:

class Plugin {
	apply(compiler) {
		compiler.hooks.thisCompilation.tap("Plugin", compilation => {
			compiler.webpack.NormalModule.getCompilationHooks(compilation).loader.tap(
				"Plugin",
				(_loaderContext, module) => {
					return "not work";
				}
			);
		});
	}
}

when there is a prue js/ts project and only builtin:swc-loader works. this plugin will not work

Reproduce link

https://github.com/kkaaddff/rspack-plugin-issue

Reproduce Steps

  1. Run npm install
  2. comment require('./index.scss') in index.js
  3. Run node ./build.js and Plugin will no work
@kkaaddff kkaaddff added the pending triage The issue/PR is currently untouched. label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

1 participant