Skip to content

Commit

Permalink
fix(nuxt): disable postcss plugin calc to resolve issue caused by ony…
Browse files Browse the repository at this point in the history
…x using the calc-constant infinity (#1261)

Building a nuxt project using the module would just hang up due to an
issue within the postcss plugin "calc" used by nanocss which is used by
nuxt's default postcss config.
This fix simply disables the plugin for nuxt projects using the module
for now. An issue was created for the postcss plugin (see:
postcss/postcss-calc#210)
  • Loading branch information
markbrockhoff authored Jun 7, 2024
1 parent 0e5225f commit 585f2f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
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

0 comments on commit 585f2f5

Please sign in to comment.