Script correcto.
"scripts": {
"build":"webpack --mode production",
"start": "webpack-dev-server --open --mode development"
},
webpack,config.js
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname,'dist'),
filename: 'main.js'
},
resolve: {
extensions: ['.js']
},
module:{
rules:[{
test: /\.js?$/,
exclude: /node_modules/,
use:{
loader: 'babel-loader'
}
}]
},
plugins: [
new HtmlWebPackPlugin([
{
inject: true,
template: './public/index.html',
filename: './index.html',
}
])
]
}
¿Quieres ver más aportes, preguntas y respuestas de la comunidad?