I'm having a little trouble with my webpack config, for some reason it doesn't create an index.html file in my /public folder.
Please see webpack.config.js below:
const path = require("path");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
let DEBUG;
if (process.env.NODE_ENV === "production") {
DEBUG = false;
} else {
DEBUG = true; // process.env.NODE_ENV === "development"
}
//const DEBUG = true; // process.env.NODE_ENV === "development"
module.exports = {
context: path.resolve(__dirname, "src"),
entry: "./index.js",
output: {
path: path.resolve(__dirname, "public"),
filename: DEBUG ? "bundle.js" : "bundle.min.js"
},
module: {
loaders: [
{
test: /\.js$/,
loader: "babel-loader",
exclude: /node_modules/
},
{
test: /\.jsx$/,
loader: "babel-loader",
exclude: /node_modules/,
options: {
presets: ["react", "es2015"]
}
},
{
test: /\.scss$/,
loaders: DEBUG
? [
"style-loader",
"css-loader?sourceMap",
"sass-loader?sourceMap",
"postcss-loader"
]
: ExtractTextPlugin.extract("css-loader!sass-loader!postcss-loader")
},
{
test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
use: "file-loader?name=images/[name].[ext]"
}
]
},
devServer: {
historyApiFallback: true,
hot: true,
},
plugins: [
new ExtractTextPlugin("style.css", {
allChunks: true
})
]
};
I've got one in my root directory and when I run in development mode everything works fine. Build script is "build": "NODE_ENV='production' webpack -p".
Thanks