-
Notifications
You must be signed in to change notification settings - Fork 273
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
@vanilla-extract/webpack-plugin - document is not defined (Next.js 13+) #1164
Comments
Small update. When importing a component from a package that uses VE and including variables in its own styles, they work correctly in the consumed application. However, there is still a problem where using variables directly from the package in the styles of the application itself causes an error. The reproducible example given in the issue is also updated to demonstrate this. Component definition: // Box.tsx
import React from "react";
import { root } from "./Box.css";
export const Box = () => <div className={root}>External box</div>; // Box.css.ts
import { style } from "@vanilla-extract/css";
import { cssVars } from "../vars";
export const root = style({
padding: cssVars.spacing["spacing-2x"],
background: "lightcoral",
}); Consumption of component: import { homePageRoot } from "@/styles/app.css";
import { Box } from "@example-monorepo/design-system";
const HomePage = () => {
return (
<div className={homePageRoot}>
Next App
<Box />
</div>
);
};
export default HomePage; |
I had the same error when attempting to integrate Storybook into my vanilla-based monorepo. I was able to resolve it by adding the |
Could you please provide a reproducible example? |
I had a similar error, so basically when trying to import any css file into *.css.ts files throw errors in the new app directory. This css file is imported into your cssVars file when bundled. |
Thank you for taking the time to address this issue. I'm focused on another project right now, as soon as I have time to review your changes to my repository I'll look into it in more detail. |
Describe the bug
An application and package has been created in the monorepository that contains the definition of base tokens that are implemented using vanilla extract. Rollup and the corresponding plugin - @vanilla-extract/rollup-plugin, are used to build this package.
This package should be used in applications and other local libraries that will implement UI components.
After building the package and trying to import the created variables into the consumer application, I get an error:
I've looked at other issues in the repository with similar cases, but the proposed solutions are mostly based on the fact that you have to create a separate entry point for exporting style-related entities to get something like this:
However, in this case, it's probably not relevant, since nothing other than that is exported from the package.
I may be wrong somewhere.
Reproduction
https://github.com/Dessader/vanilla-extract-style-issue
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: