@Vasya-prijevalskij

Что значит эта ошибка, которая выдается в консоли при попытке подключить webpack?

Всем привет. Пытаюсь подключить вебпак и постоянно при запуске команды npm run build получаю вот такую ошибку и пустой файл bundle.js:
asset bundle.js 99 bytes [emitted] (name: main)

ERROR in main
Module not found: Error: Can't resolve '.src/index.js' in 'C:\Users\User\Desktop\Проекты\Mim'
resolve '.src/index.js' in 'C:\Users\User\Desktop\Проекты\Mim'
Parsed request is a module
using description file: C:\Users\User\Desktop\Проекты\Mim\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
looking for modules in C:\Users\User\Desktop\Проекты\Mim\node_modules
C:\Users\User\Desktop\Проекты\Mim\node_modules\.src doesn't exist
C:\Users\User\Desktop\Проекты\node_modules doesn't exist or is not a directory
C:\Users\User\Desktop\node_modules doesn't exist or is not a directory
C:\Users\User\node_modules doesn't exist or is not a directory
C:\Users\node_modules doesn't exist or is not a directory
C:\node_modules doesn't exist or is not a directory

webpack 5.72.0 compiled with 1 error in 69 ms

Файл webpack.config:
const path = require('path');

module.exports = {
  mode: 'development',
  entry: '.src/index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  watch: true,

  devtool: "source-map",

  module: {}
};


Package.json:
{
  "name": "mim",
  "version": "1.0.0",
  "description": "Mim",
  "main": "webpack.config.js",
  "scripts": {
    "build": "webpack"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "webpack": "^5.72.0",
    "webpack-cli": "^4.9.2"
  }
}


Структура сайта:
Mim
-dist/bundle.js
-node_modules
-src/index.js
-index.html
-package-lock.json
-package.json
-webpack.config.js

Может кто знает в чем проблема? Подскажите, пожалуйста
  • Вопрос задан
  • 2924 просмотра
Решения вопроса 1
sergiks
@sergiks Куратор тега JavaScript
♬♬
- entry: '.src/index.js',
+ entry: './src/index.js',


потеряли кое-кого
олды тут?627969ac921d2959756510.jpeg
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы