libyear icon indicating copy to clipboard operation
libyear copied to clipboard

Add correct export in the package.json

Open francois2metz opened this issue 2 years ago • 0 comments

Hi there,

I wanted to integrate this package as a library using es imports. I had some troubles while importing the libyear.js

import { libyear } from 'libyear'; Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/code/node_modules/libyear/src' is not supported resolving ES modules imported from /code/src/index.mjs

import { libyear } from 'libyear/libyear.js'; Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './libyear.js' is not defined by "exports" in /code/node_modules/libyear/package.json imported from /code/src/index.mjs

import { libyear } from 'libyear/src/libyear.js'; Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './src/libyear.js' is not defined by "exports" in /code/node_modules/libyear/package.json imported from /code/src/index.mjs

With the fix you can import libyear: import { libyear } from 'libyear';

francois2metz avatar Jun 18 '23 21:06 francois2metz