mdx-embed
mdx-embed copied to clipboard
chore/babel-esm
- change babel config to export ESM
@spences10 If you happen to speak to Chris again i think this is what we'll need but i've gotta be honest i've run out talent with Babel.
Before this PR i was transforming syntax to cjs
, and now i've removed @babel/plugin-transform-modules-commonjs
and set @babel/preset-env
to "modules": false
which i think now will export just the ES syntax.
If you give this a pull and run yarn build
and have a look at the dist
folder the exported code looks much more like the kinda thing we'd write.
Also made a small change to tsconfig
as i was exporting the types to a types
dir but wasn't point the declarationDir
at that dir so we would have proabably had a "types not found" error if we'd tried to use the package in a TypeScirpt project.
I think that's it mate, Chris said that we'd need to ship an ESM build to do that configure TS to pass through ESM, compile the JSX and remove the Type annotations then output the ESM to module.
Chris also referenced the keys options in microbundle for how to export: https://www.npmjs.com/package/microbundle
And the TS Handbook, but I can't find specifically where he was referencing, sorry: https://www.typescriptlang.org/docs/handbook/modules.html
@spences10 i have that already in the tsconfig i'm assuming it has to be true
right?
@spences10 lets shelve this for the moment. With export to ES Modules rather than Common Js both the Next demos break. I don't know enough about this to know what needs to be changed.