Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make webpack-stream agnostic of the webpack version #188

Closed
wants to merge 1 commit into from
Closed

Make webpack-stream agnostic of the webpack version #188

wants to merge 1 commit into from

Conversation

germain-gg
Copy link

The current implementation of webpack-stream forces developers to use the webpack version defined in the package.json.
Realistically we can assume that this package will always be used in a context where its host have webpack as dependency. This is why we can leverage the npm peer dependencies.

I added the package install-peer-dependencies so that we can run the unit tests even if the project is not embedded anywhere.
I also decided not to add that to the postinstall npm hook because it is intended for development purposes only.

Those change bring up another problems though. The unit tests are very version dependant and about 80% of them are failing if we try running this with webpack 4.

Not too sure what to do with those, I'd be happy to listen to your recommendation and update accordingly.

@thetumper thetumper mentioned this pull request Jun 7, 2018
@rgov
Copy link

rgov commented Jun 27, 2018

Thanks for the changes, Germain. For others taking a look, I installed using npm i --save-dev https://github.com/gsouquet/webpack-stream.git and it resolved the issues I was seeing.

I hope @shama has a few cycles to spare to move this pull request forward.

@shama
Copy link
Owner

shama commented Jun 27, 2018

The tests are likely failing because webpack-stream needs updates in order to work with webpack 4, hence the normal dependency. I think I've mentioned it before in this project's issue board but peer dependencies are flawed and don't solve this issue.

If you really want to use your own version of webpack without waiting for it to be updated, then as shown in the docs, you can supply your own version of webpack as a second parameter:

const gulp = require('gulp');
const webpack = require('webpack');
const gulpWebpack = require('webpack-stream');
gulp.task('default', function() {
  return gulp.src('src/entry.js')
    .pipe(gulpWebpack({}, webpack))
    .pipe(gulp.dest('dist/'));
});

@germain-gg
Copy link
Author

Thanks for your update on that! 👍
Do you remember why peer dependencies are flawed by any chance? Otherwise i'll try to dig in the issues board

@germain-gg germain-gg closed this Jun 27, 2018
@rgov
Copy link

rgov commented Jun 28, 2018

as shown in the docs, you can supply your own version of webpack as a second parameter

For what it's worth, though others reported this working in #180, I had copied the exact code from the README and tried passing in the latest webpack module and it seemed to ignore what I passed in and continued to use the older webpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants