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

fix(nuxt): disable postcss plugin calc to resolve issue caused by onyx using the calc-constant infinity #1261

Merged
merged 3 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lovely-wasps-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sit-onyx/nuxt": patch
---

fix build issue in nuxt projects using @sit-onyx/nuxt
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ blob-report/
storybook-static
eslint-results.sarif
.nuxt
.output

# Development config
.env*
8 changes: 8 additions & 0 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ export default defineNuxtModule<ModuleOptions>({
},
defaults: {},
setup(_options, nuxt) {
/**
* The calc plugin of cssnano doesn't work with calc constants (https://developer.mozilla.org/en-US/docs/Web/CSS/calc-constant) used within onyx.
* Therefor it needs to be disabled temporarily until they are either no longer used inside onyx or the calc plugin is fixed.
* An issue was raised for inside the calc plugin: https://github.com/postcss/postcss-calc/issues/210
*/
nuxt.options.postcss.plugins.cssnano ??= {};
nuxt.options.postcss.plugins.cssnano.preset = ["default", { calc: false }];

nuxt.options.css.push("sit-onyx/style.css");

Object.keys(onyx)
Expand Down