Hey, I think this may be considered ‘general’ advice to be asking, hopefully get a pointer still:
I have created a custom mu-plugin: /mu-plugins/test-plugin.
Inside my plugin directory I am including the GetStream JS via CDN: wp_enqueue_script('getstream', '//cdn.jsdelivr.net/npm/getstream/dist/js_min/getstream.js', null, null, true);
However, when attempting to require or importgetstream: const stream = require('getstream');
Uncaught ReferenceError: require is not defined
or Uncaught SyntaxError: Cannot use import statement outside a module
A friend mentioned this earlier:
"Your original main.js is going through a babel-like transpiler and converting ES6 to vanilla JS, so import works there, I imagine you haven’t set one up inside your plugins
Right now I am just trying to get a proof of concept up and running, any advice how to be able to run: const stream = require('getstream'); without having to do a whole install of babel-like transpiler inside the plugin too. Even a vanilla JS approach would do just to test with.