How do I use webpack to hot update es6 code to es5 code? (note that it is not packing)

problem description

A large and comprehensive java framework is used in the project development, which integrates the front and back end. The front end develops jsp pages on the basis of this framework, and the front end is not completely separated from the front end. Now we have some js code that uses ES6 syntax, but then we encounter IE compatibility issues and have to convert the code to ES5,ES6 template strings. Alas ~

what methods have you tried

at present, the source code for ES6 used in babel, is simply configured to be placed in a directory. After src,babel translation, the code is put into a directory dist, but every time the code is changed, you have to manually type the command, which is also quite troublesome. So I would like to ask friends who are familiar with webpack whether they can automatically compile the code with babel through webpack, that is, "hot update". But it"s important to note that it"s not packaged, it"s just a bunch of js files translated into another pile of js files.

May.12,2021

does not need webpack,babel-cli to support watch mode. If watch is still troublesome, and since packaging is not involved, this automated build process can be left to gulp/grunt.

Menu