dts-bundle icon indicating copy to clipboard operation
dts-bundle copied to clipboard

Duplicated imports after bundle into single .d.ts file

Open nxddsnc opened this issue 7 years ago • 3 comments

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?

nxddsnc avatar May 02 '18 03:05 nxddsnc

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

chiefmc avatar Jul 07 '18 14:07 chiefmc

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 avatar Aug 30 '18 19:08 Borewit

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

Borewit avatar Sep 04 '18 18:09 Borewit