puemos / hls-downloader

Web Extension for sniffing and downloading HTTP Live streams (HLS)
https://puemos.gitbook.io/hls-downloader/
MIT License
1.88k stars 232 forks source link

Error: [vite]: Rollup failed to resolve import "@hls-downloader/core/lib/store" #330

Closed 0xdevalias closed 5 months ago

0xdevalias commented 5 months ago

Describe the bug

With tag v4.0.1 checked out, running ./scripts/build.sh gets the following error:

..snip..

> @hls-downloader/background@4.0.1 build
> vite build

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.1.7 building for production...
✓ 1 modules transformed.
x Build failed in 32ms
error during build:) ⠼ reify:unist-util-visit-parents: http fetch GET 200 https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1
Error: [vite]: Rollup failed to resolve import "@hls-downloader/core/lib/store" from "/Users/devalias/dev/hls-downloader/src/background/src/index.ts".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:67195:27)
    at onRollupWarning (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:67223:9)
    at onwarn (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:66927:13)
    at file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:17398:13
    at Object.logger [as onLog] (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:19056:9)
    at ModuleLoader.handleInvalidResolvedId (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:18002:26)
    at file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:17960:26

..snip..

To Reproduce Steps to reproduce the behavior:

  1. git fetch
  2. git checkout v4.0.1
  3. ./scripts/build.sh
  4. See error

Expected behavior Everything would build properly.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context N/A

0xdevalias commented 5 months ago

Apparently it can be triggered more specifically with ./scripts/build-background.sh:

⇒ scripts/build-background.sh

up to date, audited 54 packages in 617ms

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> @hls-downloader/background@4.0.1 build
> vite build

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.1.7 building for production...
✓ 1 modules transformed.
x Build failed in 33ms
error during build:
Error: [vite]: Rollup failed to resolve import "@hls-downloader/core/lib/store" from "/Users/devalias/dev/hls-downloader/src/background/src/index.ts".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:67195:27)
    at onRollupWarning (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:67223:9)
    at onwarn (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:66927:13)
    at file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:17398:13
    at Object.logger [as onLog] (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:19056:9)
    at ModuleLoader.handleInvalidResolvedId (file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:18002:26)
    at file:///Users/devalias/dev/hls-downloader/src/background/node_modules/rollup/dist/es/shared/node-entry.js:17960:26
puemos commented 5 months ago

Thanks! it's been fixed

0xdevalias commented 5 months ago

Commit for future reference: https://github.com/puemos/hls-downloader/commit/5c415bca50e771424b6575a392ecc6fc5c84771b