-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Next js error "Error: Element type is invalid: expected a string" #338
Labels
Comments
Can reproduce, I did get it to work using a not so clean workaround https://stackblitz.com/edit/nextjs-9rrzrs?file=pages/index.js |
Everywhere in const baseStyled = scStyledInterop(component);
return getCreateStyle(config ? baseStyled.withConfig(config) : baseStyled, css, generator);
};
};
const createStyled = (generator) => {
const css = createCssFunction(generator);
const styled = createBaseStyled(css);
const xstyled = createBaseStyled(css, generator);
styled.box = xstyled("div");
Object.keys(scStyledInterop).forEach((key) => {
styled[key] = styled(key);
styled[`${key}Box`] = xstyled(key);
});
return styled;
};
const createX = (generator) => {
const xstyled = createBaseStyled(createCssFunction(generator), generator);
const x = {};
- Object.keys(scStyled).forEach((tag) => {
+ Object.keys(scStyledInterop).forEach((tag) => {
x[tag] = xstyled(tag)``;
});
return x;
};
|
gregberge
added a commit
that referenced
this issue
Jan 10, 2022
gregberge
added a commit
that referenced
this issue
Jan 10, 2022
gregberge
added a commit
that referenced
this issue
Jan 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug Report
I get this error in next js 12, and I have followed the Next js instruction on the website. The problem might be that next js 12 uses swc as compiler and not babel
To Reproduce
Create next js app and try to use xstyled
Expected behavior
It should work without any problem
Run
npx envinfo --system --binaries --npmPackages @xstyled/system,@xstyled/styled-components,styled-components --markdown --clipboard
Paste the results here:
The text was updated successfully, but these errors were encountered: