nitro icon indicating copy to clipboard operation
nitro copied to clipboard

webtorrent breaks rollup build in dev mode

Open nitedani opened this issue 2 years ago • 2 comments

Environment

nitropack: 0.4.4 node: 16.13.2 no config

Reproduction

  1. create a new project
  2. install webtorrent
  3. add this code:
import WebTorrent from "webtorrent";
const client = new WebTorrent();

export default () => "Hello World";
  1. npx nitropack dev

Describe the bug

Rollup errors, the server doesn't run. All is fine and webtorrent works as expected with npx nitropack build and node .output/server/index.mjs image image

Additional context

No response

Logs

No response

nitedani avatar May 16 '22 03:05 nitedani

Possible duplicate of https://github.com/unjs/nitro/issues/200?

birdlavv avatar May 21 '22 19:05 birdlavv

Same with @prisma/client. nitropack: 0.4.4

import { PrismaClient } from "@prisma/client";
const client = new PrismaClient();
export default () => ''
 Rollup error:  Cannot read properties of null (reading 'included')                                                                                                                                       nitro 17:33:41  

  at Module.isIncluded (/C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/rollup.js:12671:25)
  at /C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/rollup.js:16144:17
  at Array.filter (<anonymous>)
  at getIncludedModules (/C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/rollup.js:16143:38)
  at Bundle.generateChunks (/C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/rollup.js:16089:40)
  at async Bundle.generate (/C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/rollup.js:15966:28)
  at async /C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/rollup.js:23694:27
  at async catchUnfinishedHookActions (/C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/rollup.js:23053:20)
  at async Promise.all (index 0)
  at async Task.run (/C:/Users/kozac/Dev/temp-projects/nitro-app/node_modules/rollup/dist/es/shared/watch.js:4942:32)

Upd This was bypassed by add package to external:

export default defineNitroConfig({
    rollupConfig: {
        external: [
            '@prisma/client'
        ]
    }
})

cawa-93 avatar May 25 '22 14:05 cawa-93

Closing since the issue has been stalled for a long period. If experiencing issues with latest version of nitro, please feel free to open a new issue with a fresh reproduction 🙏🏼

pi0 avatar May 16 '24 17:05 pi0