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

Can not build when using PandaCSS #1227

Open
5 tasks done
YogiLiu opened this issue Nov 29, 2024 · 3 comments
Open
5 tasks done

Can not build when using PandaCSS #1227

YogiLiu opened this issue Nov 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@YogiLiu
Copy link

YogiLiu commented Nov 29, 2024

Describe the bug

I created a WXT project with PandaCSS, it work well when developping by pnpm run dev, but when I run pnpm run build, it report an error: Error: Loading PostCSS Plugin failed: Invalid URL.

Reproduction

See the steps to reproduce.

Steps to reproduce

pnpm dlx wxt@latest init  # use solidjs
cd project
pnpm install
pnpm add -D @pandacss/dev
pnpm exec panda init --postcss
pnpm run build # reports error

System Info

System:
    OS: Linux 6.12 Arch Linux
    CPU: (32) x64 AMD Ryzen 9 7950X 16-Core Processor
    Memory: 43.61 GB / 61.88 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.5.1 - ~/.local/share/pnpm/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.8.2 - ~/.local/share/pnpm/npm
    pnpm: 9.14.3 - ~/.local/share/pnpm/pnpm
    bun: 1.1.36 - ~/.local/share/bun/bin/bun
  Browsers:
    Chromium: 131.0.6778.85
  npmPackages:
    wxt: ^0.19.13 => 0.19.17

Used Package Manager

pnpm

Validations

@YogiLiu YogiLiu added the pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug label Nov 29, 2024
@aklinker1
Copy link
Collaborator

aklinker1 commented Dec 1, 2024

This is caused by WXT polyfilling the document global when importing entrypoints to get their options.

Specifically, it's because ts-evaluator's code:

createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)))

Specifically, document.baseURI is null, and that is causing the "invalid URL" error here:

new URL('index.cjs', document.baseURI)

This is the same as #931.

@aklinker1
Copy link
Collaborator

See #931 (comment) for a workaround.

@aklinker1 aklinker1 added bug Something isn't working and removed pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug labels Dec 1, 2024
@aklinker1
Copy link
Collaborator

Re-tested with fix from #1207, it didn't fix the issue with panda CSS. Same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants