Open Widdershin opened 8 years ago
Would it be possible to use ES2015 import
statements instead of require
? The motivation is to be able to test in tricycle and copy paste to development source code that often uses import
.
Yep, currently can't do it because all of the user code gets wrapped in a try catch, and imports have to be at top level.
After we move to handling errors with Rx's error operators, using import
becomes feasible.
So it actually might be possible to support importing any npm module using http://brcdn.org/
Does this also work with scoped packages?
Looks like no, not yet!
That wzrd.in issue is fixed now so we can take a crack at this again.
I'd like to give this a try if nobody is working on it.
Is the idea to provide a custom require function in the context object that will be used in vm.runInNewContext? The custom require function will grab the browserified module from http://wzrd.in
Thanks!
Great! I've added you as a collaborator and I'll assign this issue to you once you accept.
The require approach sounds promising although the asynchronous nature of getting something from wzrd.in might make it more complicated. Have a go and see how it goes :)
Could we include https://www.npmjs.com/package/detect-import-require allowing to require any module as well?
Indeed, by the asynchronous nature of wzrd.in, I think that this custom require function should keep some cache, and the vm.runInNewContext
step should occur after all modules be downloaded and cached.
Any thoughts?
All of the drivers under the @cycle namespace.