I'm trying to get my head around webpack and to do so I'm building a small webpack project.
So far it moves my two entry points and their dependencies to the dist folder, but none of the files are transpiled. I've set up babel-loader and installed the correct presets but still nothing seems to work.
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: __dirname,
entry: {
main: "./main",
renderer: "./app/js/renderer"
},
output: {
path: __dirname + "/dist",
filename: "[name].bundle.js"
},
target: "electron",
plugins: [new HtmlWebpackPlugin({
title: 'Electron Test',
chunks: ['renderer'],
inject: 'body',
hash: 'true'
})],
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|dist)/,
loader: 'babel',
query: {
presets: ['es2015', 'stage-0']
}
}
]
};
Have I missed something out here?
My package.json is as follows:
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "Electron boilerplate with ES6, SCSS and packaging.",
"main": "main.js",
"scripts": {
"start": "npm run build && electron lib",
"build": "rm -rf ./dist && webpack ."
},
"keywords": [
"Electron",
"boilerplate"
],
"author": "CWright",
"license": "CC0-1.0",
"devDependencies": {
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"babel-preset-stage-0": "^6.5.0",
"html-webpack-plugin": "^2.22.0",
"webpack": "^1.13.2",
"webpack-validator": "^2.2.7"
},
"dependencies": {
"electron": "^1.3.2"
}
}