I use babel-loader
together with Webpack to transpile JavaScript es6 to es5. Is it though possible to do the opposite? Transpile everything to es6? If not, is there another proven Webpack loader (for development or production) for that?
Versions I use (package.json):
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"ts-loader": "^4.2.0",
"typescript": "^2.8.3",
"webpack": "^4.6.0",
"webpack-cli": "^2.0.15",
"webpack-dev-server": "^3.1.3"
}
My Webpack configuration:
const path = require('path');
const config = {
mode: 'production',
entry: './src/js/app.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, use: { loader: "babel-loader" }}
]
}
};
module.exports = config;