Ребят прошу помощи! В данном конфиге файлы html и js генерятся в одну папку dist.
Как html оставить в папке dist а js переместить в dist/assets/js
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const NODE_ENV = process.env.NODE_ENV || 'development';
let CopyWebpackPlugin = require('copy-webpack-plugin');
let ExtractTextPlugin = require('extract-text-webpack-plugin');
let Autoprefixer = require('autoprefixer');
let UglifyJsPlugin = require('uglify-js-plugin');
const config = {
context: path.resolve(__dirname, './src'),
entry: {
index: './js/index.js',
about: './js/about.js',
blog: './js/blog.js'
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].js',
library: '[name]',
publicPath: './'
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel?presets[]=es2015',
},
{
test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/,
loader: 'file?name=[path][name].[ext]'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style", "css!postcss")
},
{
test: /\.(sass|scss)$/,
loader: ExtractTextPlugin.extract("style", "raw!postcss!resolve-url!sass?sourceMap")
},
{
test: /\.jade$/,
include: [
path.resolve(__dirname, "src/pages")
],
loaders: ['html-loader', 'pug-html-loader?exports=false'],
},
]
},
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 9000
},
postcss: [Autoprefixer()],
watch: NODE_ENV == 'development',
devtool: NODE_ENV == 'development' ? 'cheap-inline-module-source-map' : null,
plugins: [
new ExtractTextPlugin('assets/styles/main.css', {allChunks: true}),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({NODE_ENV: JSON.stringify(NODE_ENV)}),
new webpack.optimize.CommonsChunkPlugin(
{
name: 'common',
chunks: ['index', 'about', 'blog'],
minChunks: Infinity,
}
),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src', 'index.html'),
chunks: ['index', 'common'],
inject: 'body',
css: ['./styles/main.css']
}),
new HtmlWebpackPlugin({
filename: 'about.html',
template: path.join(__dirname, 'src', 'about.html'),
chunks: ['about', 'common']
}),
new HtmlWebpackPlugin({
filename: 'blog.html',
template: path.join(__dirname, 'src', 'blog.html'),
chunks: ['blog', 'common']
}),
]
};
module.exports = config;