Answer the question
In order to leave comments, you need to log in
Webpack, how to save to different directories?
There are two directories, for the mobile version of the site and for the normal one, in webpack, respectively, I made two entry points, but the output still turns out to be one, how can I separate the output files into directories?
var path = require('path');
var webpack = require('webpack');
var assets = 'project/assets/';
var config = {
entry: {
app: path.resolve(__dirname, assets + 'apps/add.js'),
mobile: path.resolve(__dirname, assets + 'mobile/add.js')
},
output: {
path: path.resolve(__dirname, assets + 'js'),
filename: '/apps/[name].js'
}
};
module.exports = config;
Answer the question
In order to leave comments, you need to log in
Here you essentially have two independent assemblies, if I understand the intent correctly.
This is implemented through multiple compilation, that is, an array of configs:
var config = [{
entry: ..
output: ...
}, {
entry: ..
output: ...
}];
module.exports = config;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question