Closed alex-r-bigelow closed 6 years ago
Nevermind, adding this to rollup.config.js appears to work (for anyone reaching this via google):
output: { ... },
moduleContext: {
'node_modules/sax/lib/sax.js': 'window'
}
I'll close this for now, but for the developers of this library, it might be worth swapping window
for this
or something similar
This is a very old module, and once upon a time, using things both in node and the browser required some exotic tricks.
Patch welcome to remove all that junk and just use standard commonjs style stuff.
This may be the wrong place, but after a lot of googling and poking at source code, I think this is where the problem is coming from.
Attempting to use Rollup to bundle a project that depends on xml-js, which in turn depends on sax-js, I get this problem when attempting to create a UMD bundle:
The way sax is exported feels a little exotic, and I'm having trouble understanding the purpose of attaching the library to
this
? Rollup has some settings for settingthis
contexts, but as this looks like its usage is just part of an export scheme, I don't think that's what they're talking about.Any clues as to the purpose / context of
this
?