build-plugin
build-plugin copied to clipboard
Adding types property to package.json
Is your feature request related to a problem? Please describe:
While trying to import this in a typescript file, we ran into some typscript warnings/errors because it was missing type declarations. We're unable to import BuildPlugin
unless we force typscript to ignore the type.
error TS2307: Cannot find module '@datadog/build-plugin' or its corresponding type declarations.
13 import * as BuildPlugin from "@datadog/build-plugin";
Describe the solution you'd like:
According to https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package, package.json
might need types: "./src/types.ts"
(or ./src/types.d.ts
?). We suspect this might be the cause of the missing types error.
Describe alternatives you've considered:
For now, we worked around this issue by adding // @ts-ignore
flag to the import line.
Additional context:
Hello there :wave:.
Sorry for the delays, I'm checking this right now.
I'm wondering in which context you're using import * as BuildPlugin from "@datadog/build-plugin"
?
Do you have the same issue if you're doing import { BuildPlugin } from '@datadog/build-plugin/dist/webpack';
?
Because all the types are already there, but we don't have a "main"
entry in our package.json
.
Closing this for lack of details, and this will most likely be covered by v2.