shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.4k stars 123 forks source link

gulp.webpackstream ERR - version of babel < 6.26.3 loaded but 7.0 reqd > #202

Closed rowntreerob closed 6 years ago

rowntreerob commented 6 years ago

my first project converting from gulp to webpack and trying to figure out best approach.

From the cli, i got webpack working on my project but needed to do some extra upgrade work on babel versions so that the babel loader worked correctly ( env for this part is "@babel/core": "^7.0.0-rc.1", "@babel/preset-env": "^7.0.0-rc.1", "babel-loader": "^8.0.0", )

after checking that webpack cli worked and that the native webpack.babel worked in my project folder, i wanted to try using 'webpack-stream' in the existing gulpfile but i now have dependency conflict noted in error below. It looks like if i want to use latest webpack-babel then i have to completely drop gulp.

2$ gulp altbuild
[09:40:53] Requiring external module babel-register
/home/rob/src/web-spch-v2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328
        throw e;
        ^

Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "/home/rob/src/web-spch-v2/node_modules/@babel/preset-env/lib/index.js")
    at throwVersionError (/home/rob/src/web-spch-v2/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
    at Object.assertVersion (/home/rob/src/web-spch-v2/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
    at _default (/home/rob/src/web-spch-v2/node_modules/@babel/preset-env/lib/index.js:150:7)
    at /home/rob/src/web-spch-v2/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
    at /home/rob/src/web-spch-v2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:317:46
    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (/home/rob/src/web-spch-v2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
    at OptionManager.mergePresets (/home/rob/src/web-spch-v2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
    at OptionManager.mergeOptions (/home/rob/src/web-spch-v2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
    at OptionManager.init (/home/rob/src/web-spch-v2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/home/rob/src/web-spch-v2/node_modules/babel-register/lib/node.js:103:45)
    at loader (/home/rob/src/web-spch-v2/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/home/rob/src/web-spch-v2/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)

detls "altbuild"  in gulpfile...

const webpack = require('webpack');
const gulpWebpack = require('webpack-stream');
...
gulp.task('altbuild',  () => {
  return gulp.src('app/scripts/voice.js')
    .pipe(gulpWebpack({}, webpack( require('./webpack.config.babel.js') )))
    .pipe(gulp.dest('dist/'));
});
shama commented 6 years ago

Sorry I dont use babel and don't know the answer to your question. I recommend checking out Babel's support channels.