pickr icon indicating copy to clipboard operation
pickr copied to clipboard

Update package and build scripts to ESM

Open wipeautcrafter opened this issue 1 year ago • 0 comments

Issue

When trying to import Pickr in a TypeScript project, the types add an extra .default. This means that instead of Pickr.create, TypeScript exposes Pickr.default.create.

import Pickr from '@simonwep/pickr'

const pickr = Pickr.create({
//                  ^^^^^^ Property 'create' does not exist on type (...)

Solution

Changing the type to module in package.json seems to fix the issue. The build scripts had to be updated to ESM following this change.

wipeautcrafter avatar Apr 02 '24 17:04 wipeautcrafter