During the production process, I implement a webpack configuration with the UglifyJsPlugin. However, I have encountered an issue related to npm modules that contain es6 syntaxes when deploying to production:
An ERROR in the bundle.js file from UglifyJs states: Unexpected token name "i", expected punctuation ";" [./~/joi/lib/index.js:167,0]
This error occurs because the joi module utilizes es6 syntax (such as "for (let i in etc..)"), which Uglify cannot handle. To resolve this issue, I began precompiling specific modules that use es6 using the babel-cli utility:
babel src lib
I then replaced the old folder with the newly precompiled modules. However, this solution seems impractical. Is there a way for me to manage an array of node modules (only specified ones, not all) within the webpack configuration? Thank you for your assistance!