Open mnaoumov opened 9 months ago
As per my further investigation, it seems in order to fix this issue properly, we need to find a way to bundle the module with all its dependencies and then compile them into a single JS module.
It's definitely possible but I am not that familiar with the TS bundlers and build. And moreover not so sure if @polyipseity would be interested in this to be done.
In my opinion, if we make this plugin work fine with TypeScript modules, it will open a huge opportunity for Obsidian plugin developers as we would be able to write mini-scripts in TS to test some functionality, which potentially going to be extracted into a plugin eventually.
Then we would need to migrate some missing functionality from the CustomJS
plugin and the plugin would rule the world :) (at least mine for sure :) )
It's definitely possible but I am not that familiar with the TS bundlers and build. And moreover not so sure if @polyipseity would be interested in this to be done.
In my opinion, if we make this plugin work fine with TypeScript modules, it will open a huge opportunity for Obsidian plugin developers as we would be able to write mini-scripts in TS to test some functionality, which potentially going to be extracted into a plugin eventually.
I am interested in it. There is no good way to intercept the import
statement, unlike require
. Bundling is one possible way, but I have thought of a lighter way to fix it: transforming the import
statements into our require.import
statements. This will require handling all possible import
syntax though, so I have not really gotten around to do it yet.
As I couldn't use your plugin, I wrote an equivalent for your plugin that bypasses the mentioned issue.
Considering issue #7 fixed with my PR #8
!Scripts/test.ts
!Scripts/test2.ts
and invoke from the Developer Tools console
getting error
It seems it couldn't find the relative path module