Mám dve rôzne moduly, ako študentov a zamestnancov.
- Pre študentov, súbory by mali byť vytvorené do dist priečinok so statickým cesta /študentov -
publicPath: "/students/"
. - Pre zamestnancov súbory by mali byť vytvorené do dist zložky bez statickej cesta(koreňový adresár).
Nastavím publicPath: "/students/"
ale zamestnanci súbory, statickú cestu zahrnuté aj so študentmi.
Pridal som config nižšie
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'],
})
]
};