Blank index.html while building the application ( Using BrowserHistory ) #324
Description
`const { resolve } = require('path')
const webpack = require('webpack')
const { getIfUtils, removeEmpty } = require('webpack-config-utils')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractSass = new ExtractTextPlugin({
filename: "[name].[contenthash].css",
disable: process.env.NODE_ENV === "development"
});
module.exports = env => {
const {ifProd, ifNotProd} = getIfUtils(env)
return {
entry: './App/index.js',
context: dirname,
output: {
path: resolve(dirname, './build/'),
filename: 'bundle.js',
publicPath: '',
pathinfo: ifNotProd(),
},
// devtool: ifProd('source-map', 'eval'),
devtool: ifProd('source-map', 'eval'),
devServer: {
port: 6601,
historyApiFallback: true
},
module: {
rules: [
// {
// test: /.js$/,
// exclude: /node_modules/,
// enforce: 'pre',
// loader: 'eslint-loader',
// },
{
test: /.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react'],
plugins: ['transform-object-rest-spread', 'transform-class-properties'],
}
},
{
test: /.css$/,
loader: 'style-loader!css-loader?importLoaders=1&localIdentName=[name][local]_[hash:base64:5]'
},
{
test: /.scss$/,
use: extractSass.extract({
use: [{
loader: "css-loader"
}, {
loader: "sass-loader"
}],
// use style-loader in development
fallback: "style-loader"
})
},
{
test: /.(eot|woff2|woff|ttf)$/,
loader: 'file-loader',
query: {
name: "fonts/[hash].[ext]"
}
},
{
test: /.(jpg|png|gif)$/,
loader: 'file-loader',
query: {
name: "images/[hash].[ext]"
}
},
{
test: /.(svg)$/,
loader: 'file-loader',
query: {
name: "svg/[hash].[ext]"
}
},
{
test: /.ya?ml$/,
loader: 'json-loader!yaml-loader'
},
],
},
plugins: removeEmpty([
new HtmlWebpackPlugin({
template: 'App/index.html'
}), // Generates default index.html
ifProd(new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
quiet: true,
})),
ifProd(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
})),
ifProd(new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
screw_ie8: true, // eslint-disable-line
warnings: false,
},
})),
extractSass,
])
}
}
`
Working fine with HashHistory. Please suggest me what i have made a mistake here