bun
bun copied to clipboard
error: column must be greater than or equal to 0
What version of Bun is running?
0.5.7
What platform is your computer?
Darwin 22.3.0 arm64 arm
What steps can reproduce the bug?
TS and webpack config can be found here: https://github.com/openreplay/openreplay/tree/main/frontend
Steps: cd frontend bun --bun start
What is the expected behavior?
Webpack-cli server started as per usual (example: yarn start)
What do you see instead?

Additional information
Looks like its trying to check js files inside /node_modules for some reason; everything works perfectly fine without --bun, or with yarn(every version including latest)/npm/pnpm
Sounds like there are two things going on here:
- Bun should be detecting that top-level return means its a CommonJS module
- We don't support the
vmmodule which blocks webpack from running inside bun's runtime
I get this:
➜ bun --bun start
$ webpack serve
[webpack-cli] Unable load '/Users/admin/repos/openreplay/frontend/webpack.config.ts'
[webpack-cli] Unable to use specified module loaders for ".ts".
[webpack-cli] module_1.Module._preloadModules is not a function. (In 'module_1.Module._preloadModules(service.options.require)', 'module_1.Module._preloadModules' is undefined)
[webpack-cli] Cannot find module 'typescript-node/register' from '/Users/admin/repos/openreplay/frontend'
[webpack-cli] Cannot find module 'typescript-register' from '/Users/admin/repos/openreplay/frontend'
[webpack-cli] Cannot find module 'typescript-require' from '/Users/admin/repos/openreplay/frontend'
[webpack-cli] undefined is not an object (evaluating 'Module._extensions[".js"]')
[webpack-cli] undefined is not an object (evaluating 'Module._extensions[".js"]')
[webpack-cli] Please install one of them
No longer crashing, but there still seems to be an error to investigate.
<i> [webpack-dev-server] 404s will fallback to '/index.html'
398 | exports.originalPositionFor = (map, { line, column, bias }) => {
399 | line--;
400 | if (line < 0)
401 | throw new Error(LINE_GTR_ZERO);
402 | if (column < 0)
403 | throw new Error(COL_GTR_EQ_ZERO);
^
error: `column` must be greater than or equal to 0 (columns start at column 0)
at openreplay/frontend/node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js:403:22
at mapSourcePosition (openreplay/frontend/node_modules/@cspotcode/source-map-support/source-map-support.js:415:27)
No longer crashing, but there still seems to be an error to investigate.
<i> [webpack-dev-server] 404s will fallback to '/index.html' 398 | exports.originalPositionFor = (map, { line, column, bias }) => { 399 | line--; 400 | if (line < 0) 401 | throw new Error(LINE_GTR_ZERO); 402 | if (column < 0) 403 | throw new Error(COL_GTR_EQ_ZERO); ^ error: `column` must be greater than or equal to 0 (columns start at column 0) at openreplay/frontend/node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js:403:22 at mapSourcePosition (openreplay/frontend/node_modules/@cspotcode/source-map-support/source-map-support.js:415:27)
just want to report that I probably also encountered the same issue Column must be greater than or equal to 0, got -1
➜ hardhat-experiment bunx --bun hardhat --show-stack-traces --verbose node
hardhat:core:config Loading Hardhat config from /Users/ntnhaatj/working/lab/blockchain/hardhat-experiment/hardhat.config.js +0ms
hardhat:core:global-dir Looking up Client Id at /Users/ntnhaatj/Library/Application Support/hardhat-nodejs/analytics.json +0ms
hardhat:core:global-dir Client Id found: e532f138-68a3-4a5e-af46-1cf4ab672c8b +1ms
hardhat:core:hre Creating HardhatRuntimeEnvironment +0ms
hardhat:core:hre Running task node +0ms
hardhat:core:hre Running task node:get-provider +1ms
hardhat:core:hre Creating provider for network hardhat +0ms
Error HH604: Error running JSON-RPC server: Column must be greater than or equal to 0, got -1
[native code]
Just confirming that this bug is still here for 1.0.25
@birkskyum I have the exact same issue on multiple projects that use webpack. Also when you install one of the modules you get:
[webpack-cli] Failed to load '.../webpack.config.ts' config
[webpack-cli] BuildMessage {}
I wasn't able to find any issue mentioning this problem apart from @birkskyum's comment. Does anyone have a clue what's causing the problem here? Should we maybe create a separate issue, since this one seems quite unrelated?
FIxed in https://github.com/oven-sh/bun/commit/6458907f70daad66b01e67916527ea07c260d24a