Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative imports aren't rewritten relative to outfile #56

Open
StarpTech opened this issue May 18, 2022 · 0 comments
Open

Relative imports aren't rewritten relative to outfile #56

StarpTech opened this issue May 18, 2022 · 0 comments

Comments

@StarpTech
Copy link

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'
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant