You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setup is complex as it requires a locally linked package that isn't published to anywhere yet. I hope this issue is fixable in theory only, however, I'd be happy to provide code and instructions if required.
Describe the Bug
When running next dev, the generated .next/server/app/... files are several 10s of MB large since they contain all required node modules inlined. next/dist modules and native Node.js modules are the only ones that required from actual node_modules:
All remaining files are inlined along the following way:
/***/"(rsc)/./node_modules/.pnpm/@protobufjs+inquire@1.1.0/node_modules/@protobufjs/inquire/index.js":
/*!************************************************************************************************!*\ !*** ./node_modules/.pnpm/@protobufjs+inquire@1.1.0/node_modules/@protobufjs/inquire/index.js ***! \************************************************************************************************//***/((module)=>{"use strict";eval("\nmodule.exports = inquire;\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */ function inquire(moduleName) {\n try {\n var mod = eval(\"quire\".replace(/^/, \"re\"))(moduleName); // eslint-disable-line no-eval\n if (mod && (mod.length || Object.keys(mod).length)) return mod;\n } catch (e) {} // eslint-disable-line no-empty\n return null;\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiKHJzYykvLi9ub2RlX21vZHVsZXMvLnBucG0vQHByb3RvYnVmanMraW5xdWlyZUAxLjEuMC9ub2RlX21vZHVsZXMvQHByb3RvYnVmanMvaW5xdWlyZS9pbmRleC5qcyIsIm1hcHBpbmdzIjoiQUFBYTtBQUNiQSxPQUFPQyxPQUFPLEdBQUdDO0FBRWpCOzs7OztDQUtDLEdBQ0QsU0FBU0EsUUFBUUMsVUFBVTtJQUN2QixJQUFJO1FBQ0EsSUFBSUMsTUFBTUMsS0FBSyxRQUFRQyxPQUFPLENBQUMsS0FBSSxPQUFPSCxhQUFhLDhCQUE4QjtRQUNyRixJQUFJQyxPQUFRQSxDQUFBQSxJQ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ICAgcmV0dXJuIG51bGw7XHJcbn1cclxuIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJpbnF1aXJlIiwibW9kdWxlTmFtZSIsIm1vZCIsImV2YWwiLCJyZXBsYWNlIiwibGVuZ3RoIiwiT2JqZWN0Iiwia2V5cyIsImUiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///(rsc)/./node_modules/.pnpm/@protobufjs+inquire@1.1.0/node_modules/@protobufjs/inquire/index.js\n");/***/}),
Expected Behavior
This is an issue for several reasons:
I assume this is a very costly process. It unnecessarily copies numerous megabytes and writes them to disk (for every change, I'd assume).
Wild guess (I haven't followed the thread in a while), but this might be related to !48748 and is probably the reason I get 1000+ modules logged: compiled client and server successfully in 5.1s (1150 modules)
Some modules like @grpc/grpc-js or even graphql require reference equality for certain instanceof checks, which fail when this is used: Channel credentials must be a ChannelCredentials object.
The latter fails because the credentials object is created from the (rsc)/./node_modules/.pnpm/@grpc+grpc-js@1.8.18/node_modules/@grpc/grpc-js/build/src/channel-credentials.js file. The gRPC client is stored in a separate, locally linked package that doesn't share node_modules with the main project. I think this is important because if it did, it would use the same modules.
Because the @dsh/protocols package is linked to ../protocols (linked because still in development), that file uses the (rsc)/./node_modules/.pnpm/@grpc+grpc-js@1.8.18/node_modules/@grpc/grpc-js/build/src/channel-credentials.js object to do the instanceof check. This obviously fails.
The text was updated successfully, but these errors were encountered:
If I request the package explicitly with import * as grpc from '../../../../../protocols/clients/ts/node_modules/@grpc/grpc-js';, it uses the correct inlined module and everything works as expected. There is now also only (rsc)/../protocols/clients/ts/node_modules/.pnpm/@grpc+grpc-js@1.8.18/node_modules/@grpc/grpc-js/build/src/channel-credentials.js in the bundle.
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.
This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023 Binaries: Node: 18.13.0 npm: 9.8.0 Yarn: 1.22.18 pnpm: 8.6.9 Relevant Packages: next: 13.4.12 eslint-config-next: 13.4.12 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router
Link to the code that reproduces this issue or a replay of the bug
https://github.com/DigitalerSchulhof/digitaler-schulhof
To Reproduce
Setup is complex as it requires a locally linked package that isn't published to anywhere yet. I hope this issue is fixable in theory only, however, I'd be happy to provide code and instructions if required.
Describe the Bug
When running
next dev
, the generated.next/server/app/...
files are several 10s of MB large since they contain all required node modules inlined.next/dist
modules and native Node.js modules are the only ones that required from actualnode_modules
:All remaining files are inlined along the following way:
Expected Behavior
This is an issue for several reasons:
Wild guess (I haven't followed the thread in a while), but this might be related to !48748 and is probably the reason I get 1000+ modules logged:
compiled client and server successfully in 5.1s (1150 modules)
@grpc/grpc-js
or evengraphql
require reference equality for certaininstanceof
checks, which fail when this is used:Channel credentials must be a ChannelCredentials object
.The latter fails because the credentials object is created from the
(rsc)/./node_modules/.pnpm/@grpc+grpc-js@1.8.18/node_modules/@grpc/grpc-js/build/src/channel-credentials.js
file. The gRPC client is stored in a separate, locally linked package that doesn't share node_modules with the main project. I think this is important because if it did, it would use the same modules.Because the
@dsh/protocols
package is linked to../protocols
(linked because still in development), that file uses the(rsc)/./node_modules/.pnpm/@grpc+grpc-js@1.8.18/node_modules/@grpc/grpc-js/build/src/channel-credentials.js
object to do theinstanceof
check. This obviously fails.The text was updated successfully, but these errors were encountered: