webpack-contrib/expose-loader

webpack 4

719media opened this issue ยท 12 comments

is this module going to be updated for use with webpack 4 with #61 ?

@719media Besides the peerDependency warning, did you use expose-loader with webpack >= v4.0.0? Could you confirm nothing broke ? I will patch the package then :)

Nothing broke in my project when I upgraded to webpack@4.0.0. Just got the warning.

For me expose-loader@0.7.1 stopped working when updating to webpack@4.1.0. I could not see an error message but it failed to bind jquery to window, using the following configuration:

{
    test: require.resolve('jquery'),
    use: [{
        loader: 'expose-loader',
        options: 'jQuery'
    },{
        loader: 'expose-loader',
        options: '$'
    }]
}

The most recent version (0.7.4) however seems to work fine.

zapo commented

Works fine as well for us in development.

But for some reason tests (ran with karma & karma-webpack) seems to no longer have access to exposed modules when using webpack 4. I'm running them in "development" mode with no automagic vendor chunk splitting. Not sure if expose-loader concern or not.

  Uncaught ReferenceError: jQuery is not defined

Waiting for #61 and patch asap

Released in v0.7.5 ๐ŸŽ‰

Looks like this is still happening.

webpack: 4.6.0
expose-loader: 0.7.5

@zapo Did you find a solution for the failing tests running with karma & karma-webpack?

zapo commented

@Trainmaster It's working properly now after updating everything. I'm not too sure what fixed it to be honest.

Still happening to me :/

webpack: 4.19.1
expose-loader: 0.75

This (in my entry file) works fine:

import "expose-loader?$!jquery";
import "expose-loader?jQuery!jquery";

With this (in my webpack.config) doesn't work:
{ test: require.resolve('jquery'), use: [ { loader: 'expose-loader', options: 'jQuery' }, { loader: 'expose-loader', options: '$' } ] }

Any update about this @michael-ciniawsky?

Any update on this? I'm on webpack 4.41.2 and expose-loader 0.7.5.