a1exlism
3/1/2018 - 2:19 PM

webpack_custom_dist_folder_with_plugin

/*
 * Refer: @jantimon https://github.com/jantimon/html-webpack-plugin/issues/148
 * Place javascript in a js folder
 * Place css in a css folder
 * Place html in the root folder
*/
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
  entry: './example.js',
  output: {
    path: __dirname + '/dist',
    publicPath: '',
    filename: 'js/bundle.js'
  },
  module: {
    loaders: [
      { 
        test: /\.css$/, 
        loader: ExtractTextPlugin.extract('style-loader', 'css-loader') 
        
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin(),
    new ExtractTextPlugin('css/styles.css')
  ]
};