Skip to content

Tailwind component throws an error when adding presets during dev #174

@wladpaiva

Description

@wladpaiva
  • Component or Package Name: Tailwind
  • Component or Package Version: 1.10.10
  • @jsxp-email/cli Version?: 1.10.10
  • Operating System (or Browser): Mac
  • Node Version:
  • Link to reproduction (⚠️ read below): https://stackblitz.com/edit/jsx-email-repro-paqlnl

Expected Behavior

Tailwind (although it's unocss) component should be able to load presets.

Actual Behavior

Vite throws an error which seems to be related to CJS. Here's the log of the error:

~/r/email-cjs-error via ⬢ v20.10.0 via 🍞 v1.0.26 on 🐳 v25.0.2 (orbstack) took 48.6s 
➜ nr dev
$ email preview ./templates

  🚀 jsx-email Preview

  ➜  Local:   http://localhost:55420/
✘ [ERROR] Could not read from file: /Users/wladpaiva/r/email-cjs-error/node_modules/node-stdlib-browser/cjs/mock/empty.js/promises

    ../../../local-pkg/dist/index.mjs:3:16:
      3 │ import fsp from 'node:fs/promises';~~~~~~~~~~~~~~~~~~

4:30:21 PM [vite] error while updating dependencies:
Error: Build failed with 1 error:
../../../local-pkg/dist/index.mjs:3:16: ERROR: Could not read from file: /Users/wladpaiva/r/email-cjs-error/node_modules/node-stdlib-browser/cjs/mock/empty.js/promises
    at failureErrorWithLog (/Users/wladpaiva/r/email-cjs-error/node_modules/vite/node_modules/esbuild/lib/main.js:1649:15)
    at /Users/wladpaiva/r/email-cjs-error/node_modules/vite/node_modules/esbuild/lib/main.js:1058:25
    at /Users/wladpaiva/r/email-cjs-error/node_modules/vite/node_modules/esbuild/lib/main.js:1525:9
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
``

### Additional Information
The build seems to be working fine, only dev is throwing this.

<!--
  Most issues can be expressed or demonstrated through StackBlitz or a repository.
  However, the situation may arise where some small code snippets also need to
  be provided. In that situation, please add your code below using
  Fenced Code Blocks (https://help.github.com/articles/creating-and-highlighting-code-blocks/)
-->

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions