Tengo un problema al ejecutar el comando npm run build
, el codigo que se muestra abajo es la configucacion que uso en el archivo webpack.config.js:
const HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
module: {
rules: [
{
test: /\.html$/i,
loader: 'html-loader',
options:{
attributes: false
}
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html'
})
]
}
El error que me sale es este:
C:\Users\kevin\Documents\WWW\JAVASCRIPT\06-webpack>npm run build
> [email protected] build C:\Users\kevin\Documents\WWW\JAVASCRIPT\06-webpack
> webpack
asset main.js 4.39 KiB [compared for emit] (name: main) asset ./index.html 2.39 KiB [compared for emit] runtime modules 670 bytes 3 modules cacheable modules 304 bytes ./src/index.js 96 bytes [built] [code generated] ./src/js/componentes.js 208 bytes [built] [code generated]
ERROR in Error: Child compilation failed: Module build failed (from ./node_modules/html-loader/dist/cjs.js): ValidationError: Invalid options object. HTML Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'attributes'. These properties are valid:
object { preprocessor?, sources?, minimize?, esModule? }
- validate.js:104 validate
[06-webpack]/[schema-utils]/dist/validate.js:104:11
- NormalModule.js:502 Object.getOptions
[06-webpack]/[webpack]/lib/NormalModule.js:502:19
- index.js:17 Object.loader
[06-webpack]/[html-loader]/dist/index.js:17:27
- ModuleBuildError: Module build failed (from ./node_modules/html-loader/dist/cjs.js):
- ValidationError: Invalid options object. HTML Loader has been initialized using an options object that does not match the API schema.
- - options has an unknown property 'attributes'. These properties are valid:
- object { preprocessor?, sources?, minimize?, esModule? }
- validate.js:104 validate
[06-webpack]/[schema-utils]/dist/validate.js:104:11
- NormalModule.js:502 Object.getOptions
[06-webpack]/[webpack]/lib/NormalModule.js:502:19
- index.js:17 Object.loader
[06-webpack]/[html-loader]/dist/index.js:17:27
- NormalModule.js:676 processResult
[06-webpack]/[webpack]/lib/NormalModule.js:676:19
- NormalModule.js:778
[06-webpack]/[webpack]/lib/NormalModule.js:778:5
- LoaderRunner.js:399
[06-webpack]/[loader-runner]/lib/LoaderRunner.js:399:11
- LoaderRunner.js:251
[06-webpack]/[loader-runner]/lib/LoaderRunner.js:251:18
- child-compiler.js:169
[06-webpack]/[html-webpack-plugin]/lib/child-compiler.js:169:18
- Compiler.js:534
[06-webpack]/[webpack]/lib/Compiler.js:534:11
- Compiler.js:1089
[06-webpack]/[webpack]/lib/Compiler.js:1089:17
- Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync]
[06-webpack]/[tapable]/lib/Hook.js:18:14
- Compiler.js:1085
[06-webpack]/[webpack]/lib/Compiler.js:1085:33
- Compilation.js:2526
[06-webpack]/[webpack]/lib/Compilation.js:2526:11
- Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync]
[06-webpack]/[tapable]/lib/Hook.js:18:14
- Compilation.js:2519
[06-webpack]/[webpack]/lib/Compilation.js:2519:38
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details) webpack 5.36.1 compiled with 2 errors in 1270 ms npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build: `webpack` 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\kevin\AppData\Roaming\npm-cache\_logs\2021-04-30T03_55_16_881Z-debug.log
Alguien sería tan amable de indicarme porque sale ese error. De antemano muchas gracias por el apoyo.