After setting my webpack config file, i've run "npm run build" then "npm run watch" and finally "npm run serv".
I was expecting to see the html page to display but it rendered a white page "Cannot Get/".
I suppose that the problem comes from the configuration i've made in webpack config, but can't figure out the error.
Here is my webpack config: Thanks for your help
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const clean = require('clean-webpack-plugin');
module.exports = {
mode: 'development',
entry: {
auth: "./src/auth.js",
user: "./src/user.js",
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: "[name].js",
},
devtool: 'source-map',
devServer: {
static: {
directory: path.resolve(__dirname, 'dist')
},
port: 3000,
open: true,
hot: true,
liveReload: true,
compress: true,
historyApiFallback: true,
},
module: {
rules: [
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'sass-loader'
],
},
{
test: /\.(jpg|png|svg|gif)$/,
type: 'asset/resource',
},
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'PixAvenue',
filename: 'auth.html',
template: './src/auth.html',
chunks: ['auth'],
}),
new HtmlWebpackPlugin({
title: 'PixAvenue',
filename: 'user.html',
template: './src/user.html',
chunks: ['user'],
}),
new clean.CleanWebpackPlugin(),
]
}