From 585f2f5f000ef315daf4b72e1a23ea122352e4b9 Mon Sep 17 00:00:00 2001 From: Mark Brockhoff <95471369+markbrockhoff@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:44:57 +0200 Subject: [PATCH] fix(nuxt): disable postcss plugin calc to resolve issue caused by onyx 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: https://github.com/postcss/postcss-calc/issues/210) --- .changeset/lovely-wasps-compete.md | 5 +++++ .gitignore | 1 + packages/nuxt/src/module.ts | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 .changeset/lovely-wasps-compete.md diff --git a/.changeset/lovely-wasps-compete.md b/.changeset/lovely-wasps-compete.md new file mode 100644 index 0000000000..1b7695896a --- /dev/null +++ b/.changeset/lovely-wasps-compete.md @@ -0,0 +1,5 @@ +--- +"@sit-onyx/nuxt": patch +--- + +fix build issue in nuxt projects using @sit-onyx/nuxt diff --git a/.gitignore b/.gitignore index 3e98556cd6..4b95d3a257 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ blob-report/ storybook-static eslint-results.sarif .nuxt +.output # Development config .env* \ No newline at end of file diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index 823cbf2742..5f7d26f024 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -10,6 +10,14 @@ export default defineNuxtModule({ }, 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)