-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core is not a function #232
Comments
Hi, can you please provide |
I tried to use this library in my SvelteKit project now, and I get a very similar error for my code. /src/routes/+page.svelte <script>
import bbobHTML from '@bbob/html'
import presetHTML5 from '@bbob/preset-html5'
</script>
<div>
{bbobHTML(`[i]Text[/i]`, presetHTML5())}
</div>
I created a new fresh SvelteKit project and tried to use this library there, but still the same error. The project and reproducible instructions are available at https://github.com/PeppeL-G/bbob-import-error. I tried to search for a solution and found a guy who had a similar problem with another library, and someone pointed out that the problem was that that library didn't had |
Good. Thanks! |
@PeppeL-G |
You can use https://esm.sh/ to wrap this package and enable |
Thanks for looking into this, @JiLiZART. If I understand you correct, you are basically saying that the usage examples in the README file are wrong? Because they show that it should be used as an ECMAScript module? |
Usages in examples assumes that you have babel/swc/typescript transpiler configured |
Gosh, this CommonJS modules VS ECMAScript modules drives me crazy xD In an ECMAScript module executed by Node.js, I've noticed that the following works: import bbobHTML from '@bbob/html'
import presetHTML5 from '@bbob/preset-html5'
console.log(`Hello`, bbobHTML.default(`[i]Text[/i]`, presetHTML5.default())) This workaround in Node.js (with adding But the same workaround does not work in web browsers, because web browsers don't have this interoperability, but only support ECMAScript modules? SvelteKit, which in turn uses Vite, does support TypeScript, which |
Deploying ESM versions of this packages not possible. Cause it requires |
Can we just rename the ESM file output to |
It's currently not possible ship CommonJS and ESM at the same time. |
You can, if you change the extension to |
I am getting following error and not sure how to fix
core is not a function
toHTML@http://localhost:3001/static/js/bundle.js:1070:52
Here is a bit from my package.json
"dependencies": {
"@bbob/core": "^3.0.2",
"@bbob/html": "^3.0.2",
"@bbob/preset-html5": "^3.0.2",
"react": "^18.2.0",
what I am importing
How i am using it "roadEncounters.events" is a json array objects
The text was updated successfully, but these errors were encountered: