solidjs / solid-meta

Write meta tags to the document head
127 stars 16 forks source link

Implemented plugin to build solid-meta not only as ESM but also as CJS #12

Closed fednelpat closed 2 years ago

fednelpat commented 2 years ago

This change is backwards compatible. It makes it so index.tsx isn't only compiled to esm, but to cjs, too. Without this when this package was imported using require(), it would throw an error about not supporting requiring an es module.

ryansolid commented 2 years ago

For SSR to work properly we should be compiling the project with the right options Like generate: "ssr" and hydrate: true It is standard for us to not precompile all 4 variations in cjs and esm (8 variations in all). Instead we use the solid export condition that exposes the source and compile it as part of the app.

It seems to be working with the wrong build, but I can't make that guarantee for the future. Instead of offering a cjs, the esm build is only there for cdn/build-less setups. For SSR we should be building the library from source.

ryansolid commented 2 years ago

Closing as you need to use a bundler/transform to use this package on the server anyway. This means I believe ESM is a given.