Open EvHaus opened 2 years ago
Just confirming this is still an issue in 7.0.0-rc.3
. I haven't been able to find any workaround yet.
One of the main differences between 6.5 and 7.0 is that 6.5 is webpack4 by default and 7.0 is webpack5 only. Is the version of stylus-loader
you're using webpack5 compatible?
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack4-support-discontinued
Yes, it's webpack5-compatible. I'm using the latest version and my main app build is using webpack 5.
I'm having the same issue on 7.0.0-rc.8
, even tried a different loader https://github.com/slightlyfaulty/stylus-native-loader and gives the same error.
The main app is running fine with webpack 5 and the same loader configuration as storybook
I created a reproduction repository using Storybook 7.0.2. https://github.com/AumyF/repro-storybook7-stylus
[Root]
is the string representation of Stylus's AST root node (src).
The implementation of stylus
compiler depends on AST node constructors' name
such as Root
, which is renamed like Root2
during storybook dev
or build
. https://github.com/stylus/stylus/blob/73708f31a28bbf289896036c12d0e500bda3605b/lib/visitor/index.js#L26-L30
When the compiler couldn't find a method corresponding to an AST node it just returns the AST object instead of compiled CSS source string. It's passed to the latter loader (typically css-loader
) and it reports a syntax error.
It was not clear why the variable names were rewritten only on Storybook 7.
Can confirm this is also happening when the builder is Vite
. Unknown word error.
Switching to another preprocessor doesn't cause the error, but stylus + SB7 + Vite simply breaks
Issue still exists as of Storybook 7.0.7 - can anyone think of any workarounds (using webpack 5)?
I think I may found the issue causing it.
this is where to set keepNames
of esbuild conf
Hi. Is there any updates about stylus + vue + vite build for this issue? I have troubles with vue-vite build and stylus styles version 7.0.13 doesn't work with stylus
Hi. Is there any updates about stylus + vue + vite build for this issue? I have troubles with vue-vite build and stylus styles version 7.0.13 doesn't work with stylus
I have downgraded storybook version to 6.5.16 and it solved my problem.
Just tried 7.0.23 which has the PR that should fix the problem but I'm still getting the error. Is there some setting or flag I need to enable first?
@youngboy if the PR doesn't address this issue, we should probably revert the PR.?
Hi, the PR resolves the issue, but it looks like it's not present in the code when using v7.0.23
(see node_modules/@storybook/core-common/dist/index.js
, no occurences of keepNames
is found. Adding it manually does fix the problem)
Will be part of https://github.com/storybookjs/storybook/pull/23185
Unfortunately the issue is still happening for me with v7.0.24. I've updated the repro repo here: https://github.com/EvHaus/storybook-7-stylus-bug
Unfortunately the issue is still happening for me with v7.0.24. I've updated the repro repo here: https://github.com/EvHaus/storybook-7-stylus-bug
seems there are two issues here
keepNames
still not present in v7.0.24
keepNames: true
throw ReferenceError: __name is not defined
error (looks like conflict with Webpack css-loader); switch to @storybook/react-vite
framework is workingMaybe by default storybook should turn keepNames off, and expose a configuration option to turn it on, more info see https://github.com/vitejs/vite/pull/2376#issuecomment-805285480
I've retried to build an app w/ Stylus on Storybook v7.6.4, and it all worked.
Describe the bug After upgrading from 6.5.10 to 7.0.0-alpha.26 I'm running into an issue with
stylus-loader
. When starting Storybook, I get this failure:The loader that causes this issue is:
This problem doesn't happen with the same configuration on Storybook 6.5.10.
To Reproduce
yarn
to install dependencies and then runyarn storybook
. The output in the terminal will be:System
Additional context
N/A