ฉันมีสองคนแตกต่างมอดูลเหมือนนักเรียนและพนักงาน.
- สำหรับนักเรียนแฟ้มควรถูกสร้างขึ้นใน dist โฟลเดอร์กับคลื่นเสียงบอกความเส้นทาง/งนักเรียน-
publicPath: "/students/"
. - สำหรับพนักงานแฟ้มควรถูกสร้างขึ้นไป dist โฟลเดอร์โดยไม่มีคลื่นเสียงบอกความเส้นทาง(root โฟลเดอร์)
ฉันตั้งค่า publicPath: "/students/"
แต่พนักงานแฟ้มในรูปของไฟฟ้าสถิตย์อเส้นทางก็รวมอยู่กับนักเรียน
ฉันต้องเพิ่มแล้ว the config ด้านล่างนี้
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'],
})
]
};