Konubinix' opinionated web of thoughts

Webpack Bundled JS Library With "Umd" Module System in Nodejs Throws Error: "Self" Is Not Defined

Fleeting

webpack, UMD

After lots of time wasting I found the answer in a github issue of webpack.

I can use library.type: “umd” but I just have to add the following in my webpack configuration.

module.exports = { output: { globalObject: ’this’ // This line was missing } }

https://stackoverflow.com/questions/69288186/running-a-webpack-bundled-js-library-with-umd-module-system-in-nodejs-throws-e