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

Avoid build error when building TailwindCSS without the hyva-themes.json #15

Open
GrimLink opened this issue Nov 12, 2024 · 0 comments · May be fixed by #16
Open

Avoid build error when building TailwindCSS without the hyva-themes.json #15

GrimLink opened this issue Nov 12, 2024 · 0 comments · May be fixed by #16

Comments

@GrimLink
Copy link
Contributor

GrimLink commented Nov 12, 2024

Currently if the hyva-themes.json is missing your will get the following error.

❯ npm run build

> @hyva-themes/magento2-default-theme@3.0.0 build
> NODE_ENV=production npx tailwindcss --postcss -i tailwind-source.css -o ../css/styles.css --minify

~/Developer/magento/hyva-ui/vendor/hyva-themes/magento2-default-theme/web/tailwind/node_modules/@hyva-themes/hyva-modules/src/index.js:106
hyvaThemesConfig = basePath ? fs.readFileSync(path.join(basePath, hyvaThemeJsonInModule)) : false;
                 ^

TypeError: Assignment to constant variable.
    at Object.<anonymous> (/Users/grimlink/Developer/magento/hyva-ui/vendor/hyva-themes/magento2-default-theme/web/tailwind/node_modules/@hyva-themes/hyva-modules/src/index.js:106:18)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/Users/grimlink/Developer/magento/hyva-ui/vendor/hyva-themes/magento2-default-theme/web/tailwind/postcss.config.js:1:38)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)

Node.js v20.5.1

As you can see this a lot and not very useable to our users.

Instead a console.warn() should should be displayed with a more descriptive message and the build should continue as normall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant