Mam dwa różne modułu, takich jak studenci i pracownicy.
- Dla studentów pliki muszą być tworzone w katalogu dist ze statycznym przez /studenci' -
publicPath: "/students/"
. - Dla personelu pliki muszą być tworzone w katalogu dist bez statycznego drodze(folder główny).
Zainstalowałem publicPath: "/students/"
ale statyczny ścieżkę do plików personelu również wpisany na listę uczniów.
Dodałem konfigurację poniżej
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
entry: {
students: [
'./students/css/students.css',
'./students/js/students.js',
'./students/templates/students/index.pug'
],
staff: [
'./staff/css/index.css',
'./staff/js/index.js',
'./staff/templates/index.pug',
]
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
publicPath: "/students/"
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './students/templates/students/index.pug',
chunks: ['students'],
}),
new HtmlWebpackPlugin({
filename: 'staff.html',
template: './staff/templates/index.pug',
chunks: ['staff'],
})
]
};