Importing and Requiring without explicit .civet extension #1725
Unanswered
thinkingofmaud
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
To me, importing modules without using the .civet extension feels like the most natural way to using imports (or requires)
Unplugin integrations let you do that.
Civet/source/unplugin/unplugin.civet
Line 55 in 0d97621
Running with npx civet, though, I can only import by writing the full extension.
Coffeescript had built in support for the extension using require.
You just inject it onto the entry script and could require coffeescript as it was js.
https://github.com/jashkenas/coffeescript/blob/817c39a13065a900725943c33a79252a69d779e2/src/register.coffee#L32
'@danielx/civet/register' does not work like that
Using bun native support for typescript, and the plugin I could get imports working for compilerOptions specified paths. But not for relative paths. I could not get it working on node.
Here it is, if it helps any user:
You may also configure it to work only in specified paths by putting it on the path instead.
Beta Was this translation helpful? Give feedback.
All reactions