-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide esm version #173
Comments
Found a few PRs that seem to address this: #43, #160, #171 For those of you using TypeScript and
/**
* Hack to make 'slugify' import work with "type": "module".
*/
import slugify from 'slugify'
export default slugify as unknown as typeof slugify.default
import slugify from '~/imports/slugify.js'
const slug = slugify('Some Name') |
+1 on this! |
Another alternative is to disable TypeScript checking for that line:
Although this is not ideal |
I've dealt with this in my typescript project by in-sourcing slugify and converting the code to typescript. See https://gist.github.com/glorat/5070ebd2fa275e2012a51300329a7a55 In-sourcing is de-facto a hard fork but the codebase is mature so wouldn't be an issue for most cases |
With more and more build tools (vite, nuxt, etc) going towards an esm-first build, it would be nice if a proper esm interface could be provided, i.e. transpile and distribute esm version, including correct export declaration in
package.json
.The text was updated successfully, but these errors were encountered: