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]: camel2DashComponentName resulting in an error when loading the style on demand #8972

Open
ws18250840411 opened this issue Jan 8, 2025 · 1 comment
Labels
bug Something isn't working need reproduction

Comments

@ws18250840411
Copy link

System Info

System:
OS: macOS 10.15.7
CPU: 2.6 GHz 四核Intel Core i7

Binaries:
Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
npm: 10.8.1 - ~/.nvm/versions/node/v22.3.0/bin/npm
Browsers:
Chrome: 131.0.6778.206
Safari: 17.2

Details

import { defineConfig } from "@rspack/cli";
import { rspack } from "@rspack/core";
import * as RefreshPlugin from "@rspack/plugin-react-refresh";

const isDev = process.env.NODE_ENV === "development";
const targets = ["chrome >= 87", "edge >= 88", "firefox >= 78", "safari >= 14"];

export default defineConfig({
// context: __dirname,
entry: {
main: "./src/main.tsx"
},
resolve: {
alias: {
},
extensions: ["...", ".ts", ".tsx", ".jsx", ".less", ".css", ".scss"]
},
module: {
rules: [
{
test: /.svg$/,
type: "asset"
},
{
test: /.less$/,
use: [
{
loader: 'less-loader',
},
],
type: 'css',
},
{
test: /.(jsx?|tsx?)$/,
use: [
{
loader: "builtin:swc-loader",
options: {
jsc: {
parser: {
syntax: "typescript",
tsx: true
},
transform: {
react: {
runtime: "automatic",
development: true,
refresh: true
}
}
},
rspackExperiments: {
import: [
{
libraryName: '@fexd/mobile',
libraryDirectory: 'es/exports',
camel2DashComponentName: false,
style: '{{member}}/style.css',
},
]
},
}
}
]
}
]
},
plugins: [
new rspack.HtmlRspackPlugin({
template: "./index.html"
}),
isDev ? new RefreshPlugin() : null
].filter(Boolean),
experiments: {
css: true,
},
optimization: {
minimizer: [
new rspack.SwcJsMinimizerRspackPlugin(),
new rspack.LightningCssMinimizerRspackPlugin({
minimizerOptions: { targets }
})
],
sideEffects: false
}
});

The configuration of camel2DashComponentName is invalid, resulting in an error when loading the style on demand.

Reproduce link

No response

Reproduce Steps

npm install
npm run start

@ws18250840411 ws18250840411 added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jan 8, 2025
@chenjiahan chenjiahan added need reproduction and removed pending triage The issue/PR is currently untouched. labels Jan 9, 2025
Copy link
Contributor

github-actions bot commented Jan 9, 2025

Hello @ws18250840411, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.

@chenjiahan chenjiahan changed the title [Bug]: [Bug]: camel2DashComponentName resulting in an error when loading the style on demand Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need reproduction
Projects
None yet
Development

No branches or pull requests

2 participants