crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.98k stars 192 forks source link

When import yarn pnp virtual module, file is not found in dev mode #768

Open deokseong-kim-toss opened 1 year ago

deokseong-kim-toss commented 1 year ago

Build tool

Vite

Where do you see the problem?

Describe the bug

I'm using yarn pnp monorepo.

when use peerdeps in workspaces, yarn makes virtual package. and this makes unexpected builds result in dev mode

import { A } from 'somepackage';
import { A } from '../../Users/somepath/.yarn/__virtual__/some-package-virtual-asdfasdf/~/dist/index.js';

in this case chrome show FILE NOTFOUND err because dist doesn't have yarn virtual files.

Reproduction

in yarn pnp monorepo wokspace,

repo

dependency B -> A (peerDeps) App -> B

and import B in contentScript.

Logs

No response

System Info

System:
    OS: macOS 12.6.3
    CPU: (10) arm64 Apple M1 Max
    Memory: 16.89 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node
    Yarn: 3.6.1 - ~/.nvm/versions/node/v18.14.0/bin/yarn
    npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm
  Browsers:
    Chrome: 115.0.5790.170
    Edge: 114.0.1823.67
    Safari: 16.5.1

Severity

blocking all usage of RPCE