crxjs / chrome-extension-tools

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

The plugin "externalize-deps" was triggered by this import { crx } from '@crxjs/vite-plugin' #582

Closed debpalash closed 1 year ago

debpalash commented 1 year ago

Build tool

Vite

Where do you see the problem?

Describe the bug

pnpm run dev throws error below

Reproduction

 "devDependencies": {
    "@crxjs/vite-plugin": "^2.0.0-beta.4",
    "vite": "^3.2.3",
    "vite-plugin-solid": "^2.4.0"
  },
  "dependencies": {
    "solid-js": "^1.6.2"
  }
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json'

export default defineConfig({
  plugins: [solidPlugin(),  crx({ manifest }),
  ],
  server: {
    port: 80,
  },
  build: {
    target: 'esnext',
  },
});

Logs

X [ERROR] [plugin externalize-deps] Failed to resolve entry for package "rxjs/vite-plugin". The package may have incorrect main/module/exports spefied in its package.json.

    node_modules/.pnpm/esbuild@0.15.13/node_modules/esbuild/lib/main.js:17:27:
      1327 │         let result = await callback({
           ╵                            ^

    at packageEntryFailure (file:///D:/extension/nocaptchaai/node_modulespnpm/vite@3.2.3/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:34096:)
    at resolvePackageEntry (file:///D:/extension/nocaptchaai/node_modulespnpm/vite@3.2.3/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:34093:    at tryNodeResolve (file:///D:/extension/nocaptchaai/node_modules/.pnpvite@3.2.3/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:33834:20)  
    at file:///D:/extension/nocaptchaai/node_modules/.pnpm/vite@3.2.3/nodmodules/vite/dist/node/chunks/dep-51c4f80a.js:62782:40
    at requestCallbacks.on-resolve (D:\extension\nocaptchaai\node_modulespnpm\esbuild@0.15.13\node_modules\esbuild\lib\main.js:1327:28)
    at handleRequest (D:\extension\nocaptchaai\node_modules\.pnpm\esbuild.15.13\node_modules\esbuild\lib\main.js:697:19)
    at handleIncomingPacket (D:\extension\nocaptchaai\node_modules\.pnpm\build@0.15.13\node_modules\esbuild\lib\main.js:719:7)
    at Socket.readFromStdout (D:\extension\nocaptchaai\node_modules\.pnpmsbuild@0.15.13\node_modules\esbuild\lib\main.js:647:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)

  This error came from the "onResolve" callback registered here:

    node_modules/.pnpm/esbuild@0.15.13/node_modules/esbuild/lib/main.js:11:20:
      1251 │       let promise = setup({
           ╵                     ^

    at setup (file:///D:/extension/nocaptchaai/node_modules/.pnpm/vite@3.3/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62772:27)
    at handlePlugins (D:\extension\nocaptchaai\node_modules\.pnpm\esbuild.15.13\node_modules\esbuild\lib\main.js:1251:21)
    at buildOrServeImpl (D:\extension\nocaptchaai\node_modules\.pnpm\esbud@0.15.13\node_modules\esbuild\lib\main.js:942:5)
    at Object.buildOrServe (D:\extension\nocaptchaai\node_modules\.pnpm\euild@0.15.13\node_modules\esbuild\lib\main.js:750:5)
    at D:\extension\nocaptchaai\node_modules\.pnpm\esbuild@0.15.13\node_mules\esbuild\lib\main.js:2085:17
    at new Promise (<anonymous>)
    at Object.build (D:\extension\nocaptchaai\node_modules\.pnpm\esbuild@15.13\node_modules\esbuild\lib\main.js:2084:14)
    at build (D:\extension\nocaptchaai\node_modules\.pnpm\esbuild@0.15.13ode_modules\esbuild\lib\main.js:1931:51)
    at bundleConfigFile (file:///D:/extension/nocaptchaai/node_modules/.pm/vite@3.2.3/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62735:26)

  The plugin "externalize-deps" was triggered by this import

    vite.config.js:3:20:
      3 │ import { crx } from '@crxjs/vite-plugin'
        ╵                     ~~~~~~~~~~~~~~~~~~~~

failed to load config from D:\extension\nocaptchaai\vite.config.js
error when starting dev server:
Error: Build failed with 1 error:
node_modules/.pnpm/esbuild@0.15.13/node_modules/esbuild/lib/main.js:1327:: ERROR: [plugin: externalize-deps] Failed to resolve entry for package "rxjs/vite-plugin". The package may have incorrect main/module/exports spefied in its package.json.
    at failureErrorWithLog (D:\extension\nocaptchaai\node_modules\.pnpm\euild@0.15.13\node_modules\esbuild\lib\main.js:1566:15)
    at D:\extension\nocaptchaai\node_modules\.pnpm\esbuild@0.15.13\node_mules\esbuild\lib\main.js:1024:28
n.js:1022:7)
    at D:\extension\nocaptchaai\node_modules\.pnpm\esbuild@0.15.13\node_moduleodules\esbuild\lib\main.js:1134:14
    at responseCallbacks.<computed> (D:\extension\nocaptchaai\node_modules\.pns\.pnpm\esbuild@0.15.13\node_modules\esbuild\lib\main.js:671:9)
    at handleIncomingPacket (D:\extension\nocaptchaai\node_modules\.pnpm\esbuiesbuild@0.15.13\node_modules\esbuild\lib\main.js:726:9)
    at Socket.readFromStdout (D:\extension\nocaptchaai\node_modules\.pnpm\esbu\esbuild@0.15.13\node_modules\esbuild\lib\main.js:647:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
 ELIFECYCLE  Command failed with exit code 1.

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
    Memory: 10.40 GB / 15.92 GB
  Binaries:
    Node: 19.0.0 - C:\Program Files\nodejs\node.EXE      
    npm: 9.1.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0)

Severity

blocking all usage of RPCE

A-Shleifman commented 1 year ago

@debpalash https://github.com/crxjs/chrome-extension-tools/issues/567#issuecomment-1304843039

jacksteamdev commented 1 year ago

Duplicate of #567