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

The Stylus plugin passed in through stylusOptions.use will be lost during recompilation #424

Closed
zavierkolten opened this issue Sep 17, 2024 · 0 comments · Fixed by #425
Closed

Comments

@zavierkolten
Copy link
Contributor

zavierkolten commented Sep 17, 2024

Bug report

When I add a stylus plugin to stylusOptions.use and run webpack in dev mode. At startup, everything is normal. However, after I change the code and trigger recompilation, the plugin in stylusOptions.use are gone, which leads to a build failure.

Actual Behavior

Due to the lack of plugins, the Stylus function I defined is not imported, resulting in the generated product not being correctly recognized by the css-loader.

Expected Behavior

During recompilation, the plugin in stylusOptions.use can still be found.

How Do We Reproduce?

repository: https://github.com/zavierkolten/stylus-loader-debug
branch: main

  1. Install dependencies and run
pnpm i
pnpm dev
  1. You can check "dist/main.css" to see if the output is normal
  2. Make some changes randomly in the 'src/foo.styl' file to trigger recompilation
  3. For easy viewing, I used pnpm patch to add a line of console.log to "stylus-loader/dist/index.js"

image

First time:

image

After recompiling:

image

Please paste the results of npx webpack-cli info here, and mention other relevant information

System:
    OS: macOS 14.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 92.33 MB / 18.00 GB
  Binaries:
    Node: 18.20.2 - ~/Library/Caches/fnm_multishells/35160_1726582759694/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.5.0 - ~/Library/Caches/fnm_multishells/35160_1726582759694/bin/npm
  Browsers:
    Chrome: 127.0.6533.88
    Edge: 128.0.2739.79
    Safari: 17.5
  Packages:
    css-loader: ^7.1.2 => 7.1.2 
    stylus-loader: ^8.1.0 => 8.1.0 
    webpack: ^5.94.0 => 5.94.0 
    webpack-dev-middleware: ^7.4.2 => 7.4.2
@zavierkolten zavierkolten changed the title Stylus plugins in function format will be lost during recompile The Stylus plugin passed in through stylusOptions.use will be lost during recompilation Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant