Partage
  • Partager sur Facebook
  • Partager sur Twitter

babel-loader not working

    25 février 2022 à 17:19:58

    Hello I started using Webpack yesterday everything was working fine until i decided to use babel-loader

    Here is how my project is configured

    package.json

    {
      "name": "no_name",
      "version": "1.0.0",
      "description": "training",
      "main": "js/main.js",
      "directories": {
        "doc": "docs"
      },
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "build": "webpack"
      },
      "keywords": [],
      "author": "Wilfried-Tech",
      "license": "ISC",
      "devDependencies": {
        "webpack": "^5.69.1",
        "webpack-cli": "^4.9.2",
        "webpack-dev-server": "^4.7.4",
        "babel-loader": "8.2.3",
        "@babel/core": "7.16.5",
        "@babel/preset-env": "7.16.5"
      }
    }
    
    

    webpack.config.js

    const path = require('path');
    
    const config = {
      mode: 'none',
      entry: './js/main.js',
      output: {
        path: path.resolve(__dirname, 'output'),
        filename: 'Test.js'
      },
      module: {
        rules: [
          {
            test: /\.js$/,
            use: 'babel-loader',
            exclude: /node_modules/
            }
          ]
      }
    };
    
    module.exports = config;
    

    my present nodejs modules are

    @babel/core @babel/preset-env npm babel-loader style-loader babel-polyfill webpack corepack webpack-cli css-loader webpack-dev-server csv-loader xml-loader html-webpack-plugin

    the error displayed on the screen is as follows

    >ERROR in ./js/main.js Module build failed (from ../../../../node_modules/babel-loader/lib/index.js): Error: Cannot find module './ast-types/generated'

    • Partager sur Facebook
    • Partager sur Twitter

    Wilfried-Tech ∞ Coder-Master

    babel-loader not working

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    • Editeur
    • Markdown