On codesandbox I get this error Cannot find module '@hadihallak/core' or its corresponding type declarations where if I use this package in a project locally it works both in vscode and during bundling with no issues.
Description of the problem
create a react-typescript codesandbox
import @hadihallak/core (version can be anything from 0.0.3 all the way to 0.0.9)
codesandbox will not be able to resolve the types and it will give this error Cannot find module '@hadihallak/core' or its corresponding type declarations
I tried moving adding a types field to the package.json or just naming the type files differently with no dice.
It's worth noting that we've recently updated how the library works to move bundling from tsc to preconstruct which uses rollup internally and generates types under a declarations/src/...typesGoHere folder inside the dist folder
inside the dist folder it will have a type file that exports everything from the declaration folder like so
export * from "./declarations/src/index";
and the typing issue with codesandbox started only after we did that.
🐛 bug report
On codesandbox I get this error
Cannot find module '@hadihallak/core' or its corresponding type declarations
where if I use this package in a project locally it works both in vscode and during bundling with no issues.Description of the problem
@hadihallak/core
(version can be anything from0.0.3
all the way to0.0.9
)codesandbox will not be able to resolve the types and it will give this error
Cannot find module '@hadihallak/core' or its corresponding type declarations
I tried moving adding a types field to the
package.json
or just naming the type files differently with no dice.After a lot of going back and forth, deploying multiple versions of the library, I opened the network tab as I was curious to know if types were being fetched at all and found these two requests related to this package which were giving response errors: https://prod-packager-packages.codesandbox.io/v1/typings/@hadihallak/core/0.0.3.json https://ata.codesandbox.io/api/v8/%40hadihallak%2Fcore%400.0.3.json
It's worth noting that we've recently updated how the library works to move bundling from
tsc
topreconstruct
which uses rollup internally and generates types under adeclarations/src/...typesGoHere
folder inside thedist
folder inside thedist
folder it will have a type file that exports everything from the declaration folder like soand the typing issue with codesandbox started only after we did that.
Folder structure for types:
Related fields from package.json:
Hopefully, this will help.
How has this issue affected you? What are you trying to accomplish?
Can't get the types to work in codesandbox
Link to sandbox: [link]() (optional)
Your Environment