Page does not load when using webpacked bundle for main.js


I am using some es7 features for which I need to transpile the code using babel. Rather than do this at runtime, I want to transpile the code and make a bundle which I can then use directly. Runtime transpiling makes the app just a tad bit slow on Startup. For this, I tried to use webpack. Here is the config for the main process:

let config = {
    path:path.resolve(__dirname, 'dist'),
    filename: 'electronmainbundle.js',
  resolve: {
  externals: {
  module: {
    noParse: /node_modules\/json-schema\/lib\/validate\.js/,
      test: /\.js?$/,
      exclude: /node_modules/,
      loader: 'babel-loader'
        test: /\.json/,
        loader: 'json-loader',

module.exports = config;

As you will notice, I am using the target:‘electron’ in my config which allows one to require electron related modules. This does work as the browserWindow does come up when the app is ready. However, the index.html does not load with the error:

Not allowed to load local resource: file://index.html/

I found a similar issue opened on github at [] ( however, that does not have a solution. I also did not find any other articles, questions etc when I googled this issue.

Has anyone even been able to use webpacked bundle for main.js of the main process? Or any idea how to fix this issue?