Open blittle opened 4 years ago
What part of kremling doesn't work, if you use preact-compat and alias react
and react-dom
inside of the webpack config?
Yeah, preact-compat
works fine. I was hoping to not use the compatibility layer though.
What could kremling do differently to make it work with both? The library has to do import React from 'react'
in order for jsx to work.
Potentially we could publish the src directory and remove all references to react from it - attempting to auto-inject the imports during build? Then you could use the published src directory and compile it with a different jsx pragma for preact?? I'm not sure if that would make sense - would gladly take direction from other projects that have done this.
I've actually been thinking about this lately - the core of kremling could be framework agnostic: on component mount, append css - on component unmount, remove css
seems like we could pull the core of kremling out and make framework-specific implementations (like how you guys did it with single-spa)
might be able to keep it all in the same package and force consumers to choose their framework:
import { Scoped } from 'kremling/react';
or make several packages:
import { Scoped } from 'kremling-react';
import { Scoped } from 'kremling-preact';
This is a case where monorepos are useful :)
Maybe if I get time, I'll put together a mono repo implementation
started working on a mono repo, and thought it would be fun to implement kremling inside crankjs so I started there 😄
repo: https://github.com/geoctrl/kremling-monorepo
this is just an idea - I'm open to ideas - currently includes 3 packages:
adding preact
should be pretty easy at this point - I can do that next when I get time
This is a case where monorepos are useful :)
don't hate me, but I agree with this. I feel like libraries are a good case for monorepos.
It would be great to make kremling work with preact