To simplify my code for a specific problem, let's consider the following setup: In module1.js
, I have the following class:
export class MyClass { };
And in index.js
, I import MyClass
from module1.js
and assign it to a variable:
import { MyClass } from './module1.js'
var X = MyClass();
My objective is to bundle index.js
using rollup in a way that the resulting file will look like this:
class MyClass { };
var X = MyClass();
I want to place this resulting file in a script
tag and be able to access all declared variables in the global space, for example, window.MyClass
and window.X
from other scripts.
Are there any rollup options or plugins available for achieving this?