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

Duplicated imports after bundle into single .d.ts file #60

Open
nxddsnc opened this issue May 2, 2018 · 3 comments
Open

Duplicated imports after bundle into single .d.ts file #60

nxddsnc opened this issue May 2, 2018 · 3 comments

Comments

@nxddsnc
Copy link

nxddsnc commented May 2, 2018

I successfully bundle multiple .d.ts files into a single file. But in the bundle.d.ts file, there are duplicated imports. In Angular4, using the bundled .d.ts file seems to be ok. But Angular5, webpack shows a duplicated identifier error. Here's my dts-bundle options:
{ name: 'babylon-juyee-engine', main:rootDir + '/dist/index.d.ts', out: rootDir + '/babylon-juyee-engine.d.ts', removeSource: true, outputAsModuleFolder: true }
And here's part of the .d.ts file with duplicated imports:
import { BoundingBoxRenderer, Matrix, Scene, Engine, RenderTargetTexture, Vector3, Nullable } from 'babylonjs'; import { TargetCamera, Camera, Vector3, Vector2, AbstractMesh, Scene, Matrix, Collider } from "babylonjs"; import { Engine, Mesh, Scene, Vector3, Matrix, Node, SubMesh, _InstancesBatch, Material, Effect, Geometry, AbstractMesh, BoundingInfo, Ray, PickingInfo } from 'babylonjs'; import { Mesh, Scene, Vector3, Matrix, Node, Geometry, BoundingInfo, Ray, PickingInfo } from 'babylonjs';
There are several Vector3 and Scene imported.
Is there any compile option can help me avoid duplicated imports?

@chiefmc
Copy link

chiefmc commented Jul 7, 2018

Ran into same issue while working on a UMD module.

After concatenating .d.ts files, resulting file has a repeating declarations like:
import ViewOptions = Backbone.ViewOptions;

These duplications needs to be dropped for the declaration to be valid

@Borewit
Copy link

Borewit commented Aug 30, 2018

Same issue.

In my case it was caused the normalization of the absolute full path of the same module ended up as:

  1. C:\Users\Borewit\code\github\music-metadata-browser\node_modules\music-metadata\lib\index.d.ts
  2. C:\Users\Borewit\code\github\music-metadata-browser\node_modules\music-metadata\lib

@Borewit
Copy link

Borewit commented Sep 4, 2018

It looks like one of my imports ./ instead of ./index maybe the source of the problem.

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

3 participants