I have some 3rd party code that is exported with browser-only intentions. It is wrapped in a self-invoking function that expects window
to be passed.
(function (window) { "use strict";
window['module'] = {}
})(window);
Is there a better name to describe this style module?
I would like to use webpack to require
or import
this code.
currently using webpack@3.5.1
I need this to work in Node.js and ES6 environments.
I was able to achieve this by using the imports-loader
and exports-loader
rules: [
{
test: /MyModule\.js/,
use: [
"imports-loader?window=>{}",
"exports-loader?window.MyModule"
]
},