core
core copied to clipboard
Compiled code causes unexpected issues with ESMs
-
remark-embedder-core
version: 3.0.1 -
node
version: 18.4.0 -
npm
version: 8.13.0
Relevant code or config
Copied directly from example, except added braces around the remark
import.
What you did: Ran the code.
What happened:
Nothing. The output simply created two <p>
tags, rather than the embed.
Problem description:
When doing import remarkEmbedder from '@remark-embedder/core'
you actually get an object with a single property: default
, which then actually contains the function. When passed to unified
, this does nothing. In order to use it, you must instead write remarkEmbedder.default
, which is rather counterintuitive.
Suggested solution: Change the build system to include ESM code, for importing.
Running into the same issue. I think the solution would be to either expose an ESM entry point or maybe different type definitions somehow? Not sure exactly