Answer the question
In order to leave comments, you need to log in
Saving webpack files in different folders?
Greetings!
The webpack docs have:
module.exports = {
entry: {
app: './src/app.js',
search: './src/search.js'
},
output: {
filename: '[name].js',
path: __dirname + '/dist'
}
};
Answer the question
In order to leave comments, you need to log in
Unfortunately - no way. You can only have one output path., but you can use multiple configs and export an array with these configs:
// webpack.config.js
const { join } = require('path');
const appConfig = {
entry: './src/app.js',
output: {
filename: '[name].js',
path: join(__dirname, 'dist/app')
}
};
const searchConfig = {
entry: './src/search.js',
output: {
filename: '[name].js',
path: join(__dirname, 'dist/search')
}
};
const common = {
context: __dirname,
module: {
rules: [...]
}
};
module.exports = [{
...common,
...appConfig
}, {
...common,
...searchConfig
}];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question