rsms / estrella

Lightweight and versatile build tool based on the esbuild compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Relative imports aren't rewritten relative to outfile

StarpTech opened this issue · comments

I'd expect the imports are rewritten or copied in no-bundle mode otherwise the result can't be executed.

// index.js
const { build, cliopts } = require("estrella")
const p = build({
  	entry: "foo/src/entry.ts",
  	outfile: "foo/dist/server.js",
	watch: true,
	cwd: ".",
	incremental: true,
	clear: true,
	logLevel: "debug",
	target: "node16",
	format: "cjs",
	tsc: false,
  	run: ["node", "foo/dist/server.js"],
})
// entry.ts
import "./config";
console.log("hello")

Directory structure

.
├── foo/
│   ├── dist/
│   │   └── server.js
│   └── src/
│       ├── config.ts
│       └── entry.ts
└── index.js

Error:

Error: Cannot find module './config.js'
...
 code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/starptech/repositories/foo/dist/server.js'
  ]