codymikol / karma-webpack

Karma webpack Middleware
MIT License
830 stars 222 forks source link

Expose `prebundle` event hooks similar to karma-browserify's "additional configuration options" #330

Closed bschwartz757 closed 3 years ago

bschwartz757 commented 6 years ago

BEFORE YOU SUBMIT please read the following:

I'm submitting a bug report I'm submitting a feature request True I'm submitting a support request => Please do not submit support request here, see note at the top of this template.

Webpack version: "webpack-stream": "^4.0.3"

Webpack Karma version: "karma-webpack": "^3.0.0",

Karma version: "karma": "2.0.2",

Please tell us about your environment: OSX 10.x

Browser: Chrome 66

Current behavior: I'm trying to migrate a large application from Browserify to Webpack/karma-webpack. Karma-browserify has an option to pass additional options during bundle events, as detailed here. From what I can tell, karma-browserify lacks this ability. It would be great if this does in fact exist.

Expected/desired behavior: Ability to do something like the following (inside karma.conf.js):

        browserify: {
            debug: true,
            transform: [
                'stringify',
                brfs
                /*, 'browserify-shim'*/
                , istanbul({ ignore: ['**/assets/**', '**/dist/**', '**/test/**'] })
            ],
            configure: function (bundle) {
                bundle.on('prebundle', function () {
                    bundle.require('./test/mock/session-new/', { expose: 'session' });
                    bundle.require('./test/mock/session-new/s2', { expose: 'session.s2' });
                });
            }
        }
codymikol commented 3 years ago

Currently you can pass the entire webpack configuration. Is there something specific that you're unable to do currently? Let me know if this is something you're sill interested in.

codymikol commented 3 years ago

Closing due to inactivity.