I am learning how to use Webpack 4 by building a Webpack 4 & Gulp 4 boilerplate. Gulp to handle Sass etc and Webpack to handle the JS.
The tutorial I followed gave me this command to run for the build process:
NODE_ENV=production gulp build --require babel-register --gulpfile tasks
And that makes sense, however, the tutorial I was following had Babel 6 in the example. I have upgraded my project to Babel 7 using @babel/core and @babel/preset-env instead of babel-core and babel-preset-env.
However, this means that the --require babel-register portion of the build command no longer works. What would be the workaround to get Babel 7 to compile my Gulp/Wepback files so I can continue to use import gulp from 'gulp'.
Excuse the poor terminology and poor explanation, I've been in Gulp 4 alone for so long, it's like starting again!
Update 17/04/2019
After forking the tutorial and updating all the packages I have it working with the changes listed in this pull request
https://github.com/PascalAOMS/gulp4-webpack/pull/1
Original Post 06/04/2019
I am working through what sounds like a similar tutorial (https://css-tricks.com/combine-webpack-gulp-4/ and was hitting a similar issue - the first time it hits an import statement it complains.
I made a fresh repository to just get the import statements working (ignoring the webpack stuff for the moment) and got them working with @babel/register in this repository working from this documentation.
I tried putting it into the node script definition using the
--requireflag though it doesn't seem to like it (I'll fiddle around some more) but what got it working for merequire("@babel/register")This should make babel process other require statements so that import worksI'm still working through things so I will update if I get the whole process working but for now it might get you a little further down the track.
(also - I completely forgot to add a .babelrc file in my panic for a while)