-
Notifications
You must be signed in to change notification settings - Fork 50
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
Issue with @nx/rspack 18.3.0 not able to load scss module #392
Comments
I can confirm this is happening also for css modules
|
@sdasswift did you found any workaround to make it work?
|
Using |
I gave up, switching to vite with swc, and I could even update to nx v19.1.1 |
Bump. Any news regarding this issue? Not being able to load |
@FranciscoKloganB You can load scss for a specific version of @AgentEnder Can any one from your team please look into this, since you guys are upgrading |
@sdasswift I understand that, but I really don't want to be on 18.0.6. My entire Nx workspace is recent and is using latest in all other packages. I see no reason to time-travel back so many versions. |
InvestigationI believe the problem is here; This way of parsing SolutionUsing latest non-alpha version of function withCustomFactory(config) {
const customConfig = {
...config,
module: {
...config.module,
parser: {
...config.parser,
/**
* Enable css module default imports by setting namedExports to false (e.g., import styles from './App.module.scss').
*
* When namedExports is true you must:
*
* Use namespaced depending on your tsconfig settings (e.g., import * as styles from './App.module.scss')
* Use named imports (e.g., import { container, header, text } from './App.module.scss')
*
* @see https://www.rspack.dev/guide/tech/css#css-modules
*/
'css/auto': {
namedExports: false,
},
},
rules: [
...config.module.rules,
// 👇 Enable `*.module.css` (they don't work too with current @nx/rspack setup)
{
test: /\.css$/,
type: 'css/auto'
},
// 👇 Enable `*.module.sass` and `*.module.scss`
{
test: /\.(sass|scss)$/,
use: [
{
loader: 'sass-loader',
options: {
api: 'modern-compiler', // `modern-compiler` and `sass-embedded` improves build performance
implementation: require.resolve('sass-embedded'),
},
},
],
type: 'css/auto', // 'css/auto' to support '*.module.(scss|sass)' as CSS Module
},
],
},
}
return customConfig
}
module.exports = composePlugins(withNx(), withReact(), withCustomFactory) @jaysoo after looking at module.exports = composePlugins(
withNx(),
withReact(),
withHtml(),
withStyles(), // 👈 opt-in to all defaults
) or module.exports = composePlugins(
withNx(),
withReact(),
withHtml(),
withScss(), // 👈 opt-in to `Scss` and easier to send opts into it
) or module.exports = composePlugins(
withNx(),
withReact(),
withHtml(),
withCustomFactory, // 👈 I bring my own style options
) |
Current Behavior
Getting the error - module_scss__WEBPACK_IMPORTED_MODULE_1__.default is undefined
When trying to import scss module
Expected Behavior
Should be able to import scss module. Downgraded to 18.0.6 and it works fine!
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: