Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Blank index.html while building the application ( Using BrowserHistory ) #324

Open
zeegeek opened this issue Jul 17, 2017 · 0 comments
Open

Comments

@zeegeek
Copy link

zeegeek commented Jul 17, 2017

`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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant