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

Correctly process ES6 inline/side-effect imports #79

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

arshaw
Copy link

@arshaw arshaw commented Jun 25, 2019

My typescript project sometimes outputs lines like these in the generated .d.ts files:

declare const _default: import("../plugin-system").PluginDef;
export default _default;

It's essentially an inline ES6 import statement and it's valid code within a typescript definition file. I was having trouble pinpointing the exact conditions necessary to make this happen, but it happens nonetheless.

dts-bundle does not know how to process these and it outputs the line as-is, causing an unresolved module error. This PR fixes it.

Edit

The following type of imports were also not working ("side-effect-only" imports):

import "./myfile";

I've included a fix for that as well.

@arshaw arshaw changed the title Inline import fix ES6 inline import fix Jun 25, 2019
@arshaw arshaw changed the title ES6 inline import fix Correctly process ES6 inline imports Jun 25, 2019
@arshaw arshaw changed the title Correctly process ES6 inline imports Correctly process ES6 inline/side-effect imports Jun 25, 2019
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 this pull request may close these issues.

1 participant