You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Case 1, types/color-interface.d.ts is not generated, but types/color.d.ts is generated. Furthermore, types/color.d.ts contains a non-resolvable reference to ./color-interface.
In Case 2, both types/color-interface.d.ts and types/color.d.ts are generated and everything works as expected.
This occurs silently-- webpack throws no errors when building the library, but errors appear when trying to use the library from a consuming project:
ERROR in [at-loader*] ./node_modules/my-library/dist/types/color.d.ts:1:31
TS2307: Cannot find module './color-interface'.
*note that the error above mentions at-loader, this is just because I happen to be using at-loader in my other project. The error is due to the fact that types/color-interface.d.ts does not exist.
Probable fix (not sure of other implications, haven't tested):
switch from awesome-typescript-loader to ts-loader
install babel-loader
add babel-loader to /\.ts$/ rule before ts-loader (like so)
Thanks @superamadeus! This is how it was at the beginning, switched to awesome-typescript-loader for same reasons (bugs) but seems now that ts-loader got better :)
Due to some long-standing issue with awesome-typescript-loader:
s-panferov/awesome-typescript-loader#411
s-panferov/awesome-typescript-loader#428
s-panferov/awesome-typescript-loader#432
Files with no javascript-producing code are omitted from the declaration file process. For example:
Case 1:
Case 2:
In Case 1,
types/color-interface.d.ts
is not generated, buttypes/color.d.ts
is generated. Furthermore,types/color.d.ts
contains a non-resolvable reference to./color-interface
.In Case 2, both
types/color-interface.d.ts
andtypes/color.d.ts
are generated and everything works as expected.This occurs silently-- webpack throws no errors when building the library, but errors appear when trying to use the library from a consuming project:
*note that the error above mentions at-loader, this is just because I happen to be using at-loader in my other project. The error is due to the fact that
types/color-interface.d.ts
does not exist.Probable fix (not sure of other implications, haven't tested):
awesome-typescript-loader
tots-loader
babel-loader
babel-loader
to/\.ts$/
rule beforets-loader
(like so)declarationDir
intsconfig.json
totypes
(as tsloader appears to use the provided path relative to the webpack config'soutput.path
)Again, this needs testing. I'll do a pull request shortly.
The text was updated successfully, but these errors were encountered: