Sunday, 30 April 2017

Using a NPM module with global variables in webpack

I'm trying to use the exif-js in a webpack+babeljs project. This library (exif-js) creates a global variable "EXIF", but I can't access it in Chrome devtools neither in my js script.

I tried to use webpack provide-plugin to make "EXIF" visible in all pages, but it is not working.

plugins: [
    new webpack.ProvidePlugin({
      EXIF: 'exif-js/exif.js'
    })
]

What is the best way to use this library in a webpack project?

Thanks!



via Bruno Soares

No comments:

Post a Comment