Skip to content

@nx/webpack:webpack fails when using generatePackageJson option with bun #26640

Open

Description

Current Behavior

When attempting to use bun as package manager, our nestjs and graphql-yoga apps fail to build in @nx/webpack. This seems like the final issue stopping us from migrating to bun as a package manager

Without generatePackageJson it seems to build correctly.

Expected Behavior

Should build to dist with package.json and bun.lockb

GitHub Repo

https://github.com/JesusFilm/core/tree/24-03-MA-feat-bun-package-manager

Steps to Reproduce

  1. nx build api-journeys --verbose

Nx Report

nx (global)    : 19.3.1
nx             : 19.3.1
@nx/js         : 19.3.1
@nx/jest       : 19.3.1
@nx/linter     : 19.3.1
@nx/eslint     : 19.3.1
@nx/workspace  : 19.3.1
@nx/cypress    : 19.3.1
@nx/devkit     : 19.3.1
@nx/express    : 19.3.1
@nx/nest       : 19.3.1
@nx/next       : 19.3.1
@nx/node       : 19.3.1
@nx/react      : 19.3.1
@nx/storybook  : 19.3.1
@nrwl/tao      : 19.3.1
@nx/web        : 19.3.1
@nx/webpack    : 19.3.1
typescript     : 5.2.2

Failure Logs

> nx run api-journeys:build


 NX   Unable to create bun lock files. Run bun install it's just as quick


 NX   argument 'value' must be either string of Buffer


HookWebpackError: argument 'value' must be either string of Buffer
    at makeWebpackError (/workspaces/core/node_modules/webpack/lib/HookWebpackError.js:48:9)
    at /workspaces/core/node_modules/webpack/lib/Compilation.js:3181:12
    at eval (eval at create (/workspaces/core/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at fn (/workspaces/core/node_modules/webpack/lib/Compilation.js:488:17)
    at _next0 (eval at create (/workspaces/core/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at eval (eval at create (/workspaces/core/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at Hook.eval [as callAsync] (eval at create (/workspaces/core/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/workspaces/core/node_modules/tapable/lib/Hook.js:18:14)
    at /workspaces/core/node_modules/webpack/lib/Compilation.js:523:46
    at /workspaces/core/node_modules/@nx/webpack/node_modules/copy-webpack-plugin/dist/index.js:909:9
-- inner error --
TypeError: argument 'value' must be either string of Buffer
    at new RawSource (/workspaces/core/node_modules/webpack-sources/lib/RawSource.js:16:10)
    at /workspaces/core/node_modules/@nx/webpack/src/plugins/generate-package-json-plugin.js:39:82
    at fn (/workspaces/core/node_modules/webpack/lib/Compilation.js:486:10)
    at _next0 (eval at create (/workspaces/core/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at eval (eval at create (/workspaces/core/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at Hook.eval [as callAsync] (eval at create (/workspaces/core/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/workspaces/core/node_modules/tapable/lib/Hook.js:18:14)
    at /workspaces/core/node_modules/webpack/lib/Compilation.js:523:46
    at /workspaces/core/node_modules/@nx/webpack/node_modules/copy-webpack-plugin/dist/index.js:909:9

————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target build for project api-journeys failed

Package Manager Version

bun 1.1.16

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Have tried with bun since 1.1.11 and since initial nx bun release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions