Closed craigmulligan closed 3 years ago
Hey 👋 thanks for the creating the issue. The reason I got out of bundling projects is because of issues like this. So unfortunately I don't have a definite answer for you.
Perhaps you are trying to import via require
instead of import
? If so then I imagine this will not work.
I'm not interesting in creating a CJS module as I really think its time we moved on to es modules as they are now an official standard supported by the majority of browsers and even node.
If you would like guidance on how to get out out of the world of babel/webpack then I can probably help there.
If you would like guidance on how to get out out of the world of babel/webpack then I can probably help there.
Thanks I'd be interested in any advice you have, personally I hate having a build step but haven't been able to find an alternative to jsx that feels natural. I've tried htm but I found it hard to use as my components got more complex. I assume there is a way for babel + typescript etc to be more friendly to es6 modules but it's evidently not there yet.
To resolve my issue in the short term I've create a fork and compiled to commonjs myself commit. It all seems to be working great, if you are happy to maintain a cjs output then I'll submit a PR otherwise I'll try keep my fork up-to-date for as long as I need it.
Nice, glad you managed to resolve your issue!
Regards advice on getting away from babel whilst still supporting es modules, typescript and JSX.. then I would recommend looking at either:
WMR: https://github.com/preactjs/wmr Snowpack: https://github.com/snowpackjs/snowpack
They are both modern build tools which should support your use cases and generally improve developer experience 🙌
Great thanks for advice :100:
Closing now., For anyone landing here looking for commonjs module, you should of coarse try to run things with the standard es6 modules setup, but if you can't you can get a commonjs copy with:
npm install git+https://git@github.com/hobochild/oceanwind.git
Then import it with:
import ow from 'oceanwind/index.cjs'
Hey :wave: I'd really like to try this lib, but for the life of me I can't figure out how to consume it. I have a very basic babel setup in my project. But I keep hitting this error:
I guess this is because babel is transpiling my code to commonjs and so I'm trying to require your esmodule. I've tried everything I could find inorder to include /node_module/oceanwind in my compile step but couldn't figure it out. Do you happen to know the best way to easy way to resolve this? Or would you consider a commonjs output format?
Thanks for the help!