gxc
gxc

Reputation: 5118

How to import globals using webpack + babel

I have an application that is built using Webpack and Babel and I'm trying to import a 3rd party library that does not do an export, additionally the 3rd party library attaches itself directly on the window object.

What do I need to do in my app in order to be be able to import The3rdPartyLib?

I've tried following the loader syntax per the webpack docs but it doesn't work:

import 3rdPartyGlobal from imports?window=>{}!exports?window.3rdPartyGlobal!3rdPartyModule

Upvotes: 1

Views: 281

Answers (1)

Chris Dziewa
Chris Dziewa

Reputation: 190

Perhaps you could try a similar approach found in this other question:

Expose jquery as real window object with webpack

Upvotes: 1

Related Questions