Cannot resolve "loader loader"

I am trying to configure the first node application.

I keep getting the error "Cannot resolve babel bootloader."

As a result of this error, I found a couple of sentences that do not work.

First add the following to my webpack.config.js

// resolveLoader: {
  //       modulesDirectories: '/usr/local/lib/node_modules'
  //   },

Trying to create an error that says:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.resolveLoader has an unknown property 'modulesDirectories'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }

The next suggestion is to try:

resolveLoader: {
        fallback: '/usr/local/lib/node_modules'
    },

This leads to a similar error.

Does anyone have any tips on how to get started with this configuration. Understanding the documentation is difficult: every second word is jargon, and I cannot find a starting point to find a fundamental understanding of what needs to be done to get started in this setting.

Webpack.config.js:

module.exports = {
  entry: './app/app.jsx',
  output: {
    path: __dirname,
    filename: './public/bundle.js'
  },

  resolve: {
    modules: [__dirname, 'node_modules'],
    alias: {
      Greeter: 'app/components/Greeter.jsx',
      GreeterMessage: 'app/components/GreeterMessage.jsx',
      GreeterForm: 'app/components/GreeterForm.jsx',

    },
    extensions: ['.js', '.jsx']
  },

  // resolveLoader: {
  //       fallback: '/usr/local/lib/node_modules'
  //   },

  module :{
    rules:[{
      // use : 'babel-loader',
      loader: 'babel-loader',
      query :{
        presets:['react','es2015']
        // ,'es2017'
      },
      test: /\.jsx?$/,
      exclude: /(node_modules|bower_components)/
    }
   ]
 }


};
+4
1

; , babel-loader:

yarn add babel-loader

npm install babel-loader

+9

Source: https://habr.com/ru/post/1679012/


All Articles