ES6 modules can be used now natively in some browsers (Chrome, Firefox, Safari).
For example if you look at my little test snippet below:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tile>ES6 Module Test</tile> <script type="module"> import debounce from 'https://email@example.com/debounce.js'; (debounce(() => console.log('It works!'), 500))(); </script> </head> <body> </body> </html>
Running this code outside of cables successfully loads the ES6 module and executes the debounce function.
The important part here is that the script (entrypoint) must be marked as
Being able to use the external NPM packages in cables would be huge and offer a lot of possibilities.
My recommendation would be to add a user setting “Enable experimental ES6 module support”.
When activated the cables script would be marked as
module, also when the cables patch is exported the script would need to be marked as
What do you think @pandur?
I think this should not be used in native cables ops, but for private ops for experimentation this would be great!