Git Product home page Git Product logo

Comments (3)

Jarred-Sumner avatar Jarred-Sumner commented on May 2, 2024

Can you provide a repro?

This doesn't reproduce it:

import { yes } from "./space in imported file";
export function test() {
  if (!yes) {
    throw new Error("no");
  }

  return testDone(import.meta.url);
}
// space in imported file.js
export const yes = true;

from bun.

haleksandre avatar haleksandre commented on May 2, 2024

I meant in the path of the project itself, sorry for not being precise.

To reproduce simply copy one of your example in a directory that contain a space i.e.: /path/with some spaces/app & insert a scripts in your package.json

project directory

/srv/projects/open source/examples/next

package.json

{
  "name": "@bun-examples/next",
  "version": "0.0.37",
  "main": "index.js",
  "scripts": {
    "next": "next --help"
  },
  "dependencies": {
    "next": "11.1.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-is": "^17.0.2"
  },
  "devDependencies": {
    "@types/react": "^17.0.19",
    "bun-framework-next": "^0.0.0-21",
    "typescript": "^4.3.5"
  },
  "bun-create": {
    "postinstall": [
      "bun bun --use next"
    ]
  }
}

bash

bun run next

$ next --help
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/srv/projects/open'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

As you can see bun is trying to find the module at /srv/projects/open instead of /srv/projects/open source/examples/next.

I tried to look around & I suspect the bug lies somewhere in resolve_path.zig or wherever you pass the base_path / current_path arguments for the various functions within that file but to be honest I had never heard of zig before a few days ago so I'm not familiar at all with Zig & might be wrong.

from bun.

Jarred-Sumner avatar Jarred-Sumner commented on May 2, 2024

Haven’t forgotten about this, will get to it when I can

from bun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.