Skip to content

index.js main file does not emit ./ for modules #2

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

Closed
roblav96 opened this issue Apr 11, 2019 · 3 comments · Fixed by #3
Closed

index.js main file does not emit ./ for modules #2

roblav96 opened this issue Apr 11, 2019 · 3 comments · Fixed by #3

Comments

@roblav96
Copy link

Any files emitted at the root of ./dist/*.js do not include the ./ path at the beginning of modules.

tsconfig.json

{
	"baseUrl": ".",
	"outDir": "dist",
	"target": "es5",
	"paths": {
		"@/*": ["src/*"]
	},
	"plugins": [
		{ "transform": "typescript-transform-paths" },
	]
}

Example:

Currently ./dist/index.js looks like:

var http = require("adapters/http");

When it should be:

var http = require("./adapters/http");
@roblav96
Copy link
Author

roblav96 commented Apr 11, 2019

Modifying index.ts:30 to add './' + before relative like so:

const file = './' + relative(fileDir, resolve(baseUrl, out));

fixes the problem, but I doubt this is the proper solution.

@danielpza
Copy link
Member

danielpza commented Apr 12, 2019

const file = './' + relative(fileDir, resolve(baseUrl, out));

@roblav96 It was pretty close to what I came up with, I will merge it tomorrow if you have any thoughts on it.

@roblav96
Copy link
Author

@danielpza I ended up using ilearnio/module-alias so I haven't been able to test this.

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

Successfully merging a pull request may close this issue.

2 participants