'webpack symfony engine bundle asset configuration babel loaders

symfony say function undefined , i don't understand why could you help , the message that i receive is : hello is undefinded i tried to config webpack.config.js

   const webpack = require("webpack");
   const path = require("path");

   let config = {
      mode: 'development',
      entry: "./assets/js/login.js",
      output: {
        path: path.resolve(__dirname, "./public/build/js"),
        filename: "loginn.js"
    },
     module: {
         rules: [
             {
                 test: /\.js$/,
                 use: 'babel-loader',
    //             exclude: /node_modules/,
    //             query: {
    //                 presets: ['es2015']
                }
             ]
    //         {
    //             test: /\.css$/,
    //             loaders: ['style-loader', 'css-loader']
    //         }
    //     ]
    //
    }
};
module.exports=config ;
// module.exports = Encore.getWebpackConfig();

  require ('lodash')
   var hello =function(){
   console.log('coucou');

};


Solution 1:[1]

the issue :

{%  block javascripts %}
<script type="text/javascript" src="{{ asset('./build/js/loginn.js') }}"></script>
{%  endblock %}

Expand snippet this is the way i call my js file

maybe , it's cause i am not able to use loaders as babel

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alexandre marillesse