ошибка ERROR in Error: Child compilation failed: в html-web-pack-plugin ( Webpack 5.35.1 )

const path = require('path') 
const isDev = process.env.NODE_ENV === 'development'
const isProd = !isDev
const filename = (ext) => isDev ? `[name].${ext}` : `[name].[contenthash].${ext}`
const HTMLWebpackPlugin = require('html-webpack-plugin')   

module.exports = {

    mode: 'development',                       
    context: path.resolve(__dirname, 'src'),  
    entry: './js/app.js',
    output: {
        path: path.resolve(__dirname, 'dist'), 
        filename: `./js/${filename('js')}`,    
    },
    plugins: [
        new HTMLWebpackPlugin({
            template: path.resolve(__dirname, 'src/index.html'),
            filename: 'index.html',
            minify: {
                collapseWhitespace: isProd,
            },
        }),
    ],
}

если в plugins убрать конструктор HTML То все собирается через npm run build с ним ошибка, помогите уже 2 дня не могу понять что не так

Код ошибки:

ERROR in   Error: Child compilation failed:
  Module build failed (from ../../../../#Web/JS Project/Minin auntificate project with WIrebase/node_modules/html-webpack-plugin/lib/loader.js):        
  Error: Cannot find module 'E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\html-webpack-plugin\lib\loader.js'
  Require stack:
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\loader-runner\lib\loadLoader.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\loader-runner\lib\LoaderRunner.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\NormalModule.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\NormalModuleFactory.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\Compiler.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\webpack.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\index.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack-cli\lib\webpack-cli.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack-cli\lib\bootstrap.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack-cli\bin\cli.js
  - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\bin\webpack.js

  - loader.js:880 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:880:15

  - loader.js:725 Function.Module._load
    internal/modules/cjs/loader.js:725:27

  - loader.js:952 Module.require
    internal/modules/cjs/loader.js:952:19

  - v8-compile-cache.js:159 require
    [Minin auntificate project with WIrebase]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - loadLoader.js:19 loadLoader
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/loadLoader.js:19:17

  - LoaderRunner.js:182 iteratePitchingLoaders
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:182:2

  - LoaderRunner.js:397 runLoaders
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:397:2

  - NormalModule.js:729 NormalModule.doBuild
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:729:3

  - NormalModule.js:878 NormalModule.build
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:878:15

  - Compilation.js:1311
    [Minin auntificate project with WIrebase]/[webpack]/lib/Compilation.js:1311:12

  - ModuleBuildError: Module build failed (from ../../../../#Web/JS Project/Minin auntificate project with WIrebase/node_modules/html-webpack-plugin/li 
   b/loader.js):

  - Error: Cannot find module 'E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\html-webpack-plugin\lib\loader.js'

  - Require stack:

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\loader-runner\lib\loadLoader.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\loader-runner\lib\LoaderRunner.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\NormalModule.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\NormalModuleFactory.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\Compiler.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\webpack.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\lib\index.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack-cli\lib\webpack-cli.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack-cli\lib\bootstrap.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack-cli\bin\cli.js

  - - E:\#Web\JS Project\Minin auntificate project with WIrebase\node_modules\webpack\bin\webpack.js

  - loader.js:880 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:880:15

  - loader.js:725 Function.Module._load
    internal/modules/cjs/loader.js:725:27

  - loader.js:952 Module.require
    internal/modules/cjs/loader.js:952:19

  - v8-compile-cache.js:159 require
    [Minin auntificate project with WIrebase]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - loadLoader.js:19 loadLoader
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/loadLoader.js:19:17

  - LoaderRunner.js:182 iteratePitchingLoaders
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:182:2

  - LoaderRunner.js:397 runLoaders
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:397:2

  - NormalModule.js:729 NormalModule.doBuild
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:729:3

  - NormalModule.js:878 NormalModule.build
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:878:15

  - Compilation.js:1311
    [Minin auntificate project with WIrebase]/[webpack]/lib/Compilation.js:1311:12

  - NormalModule.js:676 processResult
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:676:19

  - NormalModule.js:778
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:778:5

  - LoaderRunner.js:399
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:399:11

  - LoaderRunner.js:185
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:185:11

  - loadLoader.js:33 loadLoader
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/loadLoader.js:33:11

  - LoaderRunner.js:182 iteratePitchingLoaders
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:182:2

  - LoaderRunner.js:397 runLoaders
    [Minin auntificate project with WIrebase]/[loader-runner]/lib/LoaderRunner.js:397:2

  - NormalModule.js:729 NormalModule.doBuild
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:729:3

  - NormalModule.js:878 NormalModule.build
    [Minin auntificate project with WIrebase]/[webpack]/lib/NormalModule.js:878:15

  - Compilation.js:1311
    [Minin auntificate project with WIrebase]/[webpack]/lib/Compilation.js:1311:12

  - child-compiler.js:169
    [Minin auntificate project with WIrebase]/[html-webpack-plugin]/lib/child-compiler.js:169:18

  - Compiler.js:534
    [Minin auntificate project with WIrebase]/[webpack]/lib/Compiler.js:534:11

  - Compiler.js:1089
    [Minin auntificate project with WIrebase]/[webpack]/lib/Compiler.js:1089:17


  - Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync]
    [Minin auntificate project with WIrebase]/[tapable]/lib/Hook.js:18:14

  - Compiler.js:1085
    [Minin auntificate project with WIrebase]/[webpack]/lib/Compiler.js:1085:33

  - Compilation.js:2496
    [Minin auntificate project with WIrebase]/[webpack]/lib/Compilation.js:2496:11



1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack 5.35.1 compiled with 2 errors in 1281 ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `cross-env NODE_ENV=production webpack --mode production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\megaz\AppData\Roaming\npm-cache\_logs\2021-04-25T17_08_33_180Z-debug.log
PS E:\#Web\JS Project\Minin auntificate project with WIrebase>

Ответы (0 шт):