The js file packaged by webpack does not contain the return statement of the source file?

/ src/app.js

let a = 123
let test = value => {
    console.log(value * 2)
}
test(a)

I use console.log () here. The bundle.js packaged with webpack looks like this:

([function (e, t, n) {
    "use strict";
    ! function (e) {
        console.log(2 * e)
    }(2)
}]);

I changed console.log () in app.js to return . After packaging, the bundle.js is finally empty and does not include the code in my app.js. Why?

here is my configuration:

const webpack = require("webpack")
const path = require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin")

const config = {
    entry: "./src/app.js",
    output: {
        path: path.resolve(__dirname, "dist"),
        filename: "bundle.js",
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules)/,
                use: {
                    loader: "babel-loader",
                    options: {
                        presets: ["env"]
                    }
                }
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./src/index.html"
        })
    ]
}

module.exports = config

package.json:

{
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "7",
    "babel-preset-env": "^1.7.0",
    "html-webpack-plugin": "^3.2.0",
    "webpack": "^4.17.1",
    "webpack-cli": "^3.1.0"
  }
}

using babel-core is supposed to convert the ES6 code into ES3 and then package it into bundle.js. Why didn"t I get such a result here?

the bundle.js result I want should be like this:

var a = 123
function test(value){
    return value * 2
}
test(a)

is my posture wrong or is there something wrong with the configuration? You didn"t make a mistake when you started. Solve the problem?

May.22,2021

it's amazing, I can run it. Never mind that the change from b to an is the same result.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ebabd1-27f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ebabd1-27f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?