K
K
kirillleogky2019-12-06 10:58:22
JavaScript
kirillleogky, 2019-12-06 10:58:22

How to include script with webpack?

I can’t connect the script,
please tell me what’s the matter with
my final js
5dea09c74dd60985197499.png
that I export
5dea09d6dad18483474940.png
the text of the error
5dea09ed6d392510020624.png
project structure
5dea09fb9e76c784501579.png
webpack config

const path = require('path');

module.exports = {
  entry: './src/index.js',
  mode: 'development',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
  rules: [
    {
      test: /\.js$/,
      enforce: 'pre',
      exclude: /node_modules/,
      loader: 'eslint-loader',
    },
    {
      test: /\.js$/,
      exclude: /(node_modules|bower_components)/,
      use: {
       loader: 'babel-loader',
       options: {
        presets: ['env']
       }
      }
    },
    {
      test: /\.css$/,
      use: ['style-loader','css-loader']
    },
    {
      test: /\.(jpg|png|svg)$/,
      loader: 'url-loader',
      options: {
       name: 'img/[name].[ext]',
      },
    }
  ],
 }
};

please tell me what's wrong

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question