carlsednaoui/ouibounce

Warnings logged when used with webpack

lencioni opened this issue · 3 comments

Hi! I am using this package in a project that is built with webpack, and I am seeing the following warnings logged in my console:

./~/ouibounce/build/ouibounce.js
Critical dependencies:
10:29-36 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/ouibounce/build/ouibounce.js 10:29-36
./~/ouibounce/build/ouibounce.min.js
Critical dependencies:
4:105-112 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/ouibounce/build/ouibounce.min.js 4:105-112

Is there something special I need to do to use this with webpack?

It looks like this is happening because of the UMD build (via gulp-wrap-umd). There's an issue on that project that pointed me to a webpack plugin that helps webpack understand UMD.

That plugin did not seem to help in my situation. However, it turns out that we had some configuration that disables AMD stuff:

{
  test: /./,
  loader: 'imports?define=>false',
},

If I remove this, I can get the warnings to go away.

Just to totally close the loop on this, I ended up changing my above configuration to

{
  test: /./,
  exclude: [
    require.resolve('ouibounce'),
  ],
  loader: 'imports?define=>false',
},