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

[BUG] pnpm dev error #733

Open
2 of 3 tasks
ailikecreative opened this issue Aug 26, 2023 · 3 comments
Open
2 of 3 tasks

[BUG] pnpm dev error #733

ailikecreative opened this issue Aug 26, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@ailikecreative
Copy link

ailikecreative commented Aug 26, 2023

What happened?

pnpm dev command always has problems,I've tried repeatedly still fails
I tried to install the manual '@parcel/diagnostic' but it still got an error

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome, Microsoft Edge

Relevant log output

🟣 Plasmo v0.82.1
🔴 The Browser Extension Framework
🔵 INFO   | Starting the extension development server...
🔵 INFO   | Loaded environment variables from: []
node:internal/event_target:1012
  process.nextTick(() => { throw err; });
                           ^

Error: Cannot find module '@parcel/diagnostic'
Require stack:
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\logger\lib\Logger.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\utils\lib\index.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\core\lib\public\Config.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\core\lib\utils.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\core\lib\public\Environment.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\core\lib\public\Asset.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\core\lib\Parcel.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\core\lib\index.js
- C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@parcel\fs\lib\index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at _diagnostic (C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\logger\lib\Logger.js:24:16)
    at Logger.error (C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]\node_modules\@parcel\logger\lib\Logger.js:60:26)
    at WorkerFarm.onError (C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@parcel\workers\lib\WorkerFarm.js:205:25)
    at Worker.<anonymous> (C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@parcel\workers\lib\WorkerFarm.js:220:36)
    at Worker.emit (node:events:513:28)
    at worker.WorkerBackend.exitCode (C:\Users\Edi\Desktop\New-Develop-Web\plasmo-extension-framework\multi-tools\node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@parcel\workers\lib\Worker.js:79:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\logger\\lib\\Logger.js',
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\utils\\lib\\index.js',
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\core\\lib\\public\\Config.js',
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\core\\lib\\utils.js',
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\core\\lib\\public\\Environment.js',
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\core\\lib\\public\\Asset.js', 
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\core\\lib\\Parcel.js',        
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]\\node_modules\\@parcel\\core\\lib\\index.js',
    'C:\\Users\\Edi\\Desktop\\New-Develop-Web\\plasmo-extension-framework\\multi-tools\\node_modules\\.pnpm\\@[email protected]_@[email protected]\\node_modules\\@parcel\\fs\\lib\\index.js'
  ]
}

Node.js v18.16.0
 ELIFECYCLE  Command failed with exit code 1

(OPTIONAL) Contribution

  • I would like to fix this BUG via a PR

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@ailikecreative ailikecreative added the bug Something isn't working label Aug 26, 2023
@ailikecreative ailikecreative changed the title [BUG] [BUG] pnpm dev error Aug 26, 2023
@louisgv
Copy link
Contributor

louisgv commented Aug 27, 2023

@ailikecreative I think this should be addressed by upstream Parcel rather than Plasmo - since the stacktrace points to parcel-core. I'm not entirely sure how your project couldn't run - are you mix-matching your node/pnpm installation somehow between WSL and PWSH?... (this error and #734 potentially) might share the same cause within your system, unless you can share a clean reprod

@ailikecreative
Copy link
Author

in the contents folder, if I only put 1 file there the code runs normally, but if I put lots of sample files in my case there are 15 for each different website, when "pnpm dev" an error like that appears.

so according to the assumption that the cause is because there are too many files in the content folder, I don't know if this is true or not

@tj-noor
Copy link

tj-noor commented Sep 13, 2023

I have been running into this issue (with pnpm & windows) since I tried adding a background message handler. Right now, the only way I can get a dev build is on a Mac instead. Not sure if it's related to the libraries I have imported, but I'll try and see if I can get a repro on a new project on that windows machine.

Update: this isn't related to the background script directly - just additional files. It appears that there isn't much tree-shaking, if at all, being done on some imports like lucide-react, zod, etc. I also had react-router on a tabs entry point with multiple pages being imported lazily. That spun out separate files in the root directory with duplicated/shared bundles. My parcel cache data.mdb file was at 4gb.

After porting the extension over to work with parcel natively, build times have improved considerably and the cache data.mdb file is now sitting at under 50mb. It also seems to reuse the shared bundles more efficiently, but tree-shaking is similar since the underlying imports use conditional requires.

I came across the recommendation/work-around of increasing the minBundles like plasmo has configured due to an open issue with parcel (parcel-bundler/parcel#8071), and updating the following configuration resulted in similar bundle file sizes like plasmo, but still the smaller cache file size.

  "@parcel/bundler-default": {
    "minBundles": 10000000,
    "minBundleSize": 3000,
    "maxParallelRequests": 20
  }

In conclusion, I'll have to keep a closer eye on the imported packages as this could easily get out of hand.

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

No branches or pull requests

3 participants