2017-06-10 21:59:33 -07:00
|
|
|
const path = require("path");
|
|
|
|
const webpack = require("webpack")
|
|
|
|
const WebpackNotifierPlugin = require("webpack-notifier")
|
2017-05-05 11:28:30 +07:00
|
|
|
|
2017-06-10 21:59:33 -07:00
|
|
|
const appPath = path.resolve(__dirname, "js");
|
2017-01-12 12:26:36 -06:00
|
|
|
|
|
|
|
const PATHS = {
|
2017-06-10 21:59:33 -07:00
|
|
|
app: path.join(__dirname, "app"),
|
|
|
|
dist: path.join(__dirname, "..", "app", "dist")
|
2017-01-12 12:26:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
2017-06-10 21:59:33 -07:00
|
|
|
entry: ["babel-polyfill", "./js/main.js"],
|
2017-01-12 12:26:36 -06:00
|
|
|
output: {
|
2017-06-10 21:59:33 -07:00
|
|
|
path: path.join(PATHS.dist, "js"),
|
|
|
|
publicPath: "/js/",
|
2017-01-12 12:26:36 -06:00
|
|
|
filename: "bundle.js",
|
|
|
|
pathinfo: true
|
|
|
|
},
|
|
|
|
cache: true,
|
2017-06-10 21:59:33 -07:00
|
|
|
devtool: "eval",
|
2017-04-07 12:15:22 +07:00
|
|
|
resolve: {
|
2017-06-09 22:03:02 -07:00
|
|
|
modules: [appPath, "node_modules"],
|
2017-06-10 21:59:33 -07:00
|
|
|
extensions: [".js", ".jsx", ".css"]
|
2017-04-07 12:15:22 +07:00
|
|
|
},
|
2017-05-05 11:28:30 +07:00
|
|
|
plugins: [
|
|
|
|
new WebpackNotifierPlugin(),
|
2017-05-23 11:41:26 +04:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
ENV: JSON.stringify("development"),
|
|
|
|
}),
|
2017-06-09 22:03:02 -07:00
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
debug: true
|
|
|
|
})
|
2017-05-05 11:28:30 +07:00
|
|
|
],
|
2017-01-12 12:26:36 -06:00
|
|
|
module: {
|
2017-06-09 22:03:02 -07:00
|
|
|
rules: [
|
2017-01-12 12:26:36 -06:00
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
2017-06-09 22:03:02 -07:00
|
|
|
enforce: "pre",
|
2017-06-10 21:59:33 -07:00
|
|
|
loaders: ["eslint"],
|
2017-01-12 12:26:36 -06:00
|
|
|
// define an include so we check just the files we need
|
|
|
|
include: PATHS.app
|
2017-05-25 21:40:46 +04:00
|
|
|
},
|
2017-06-05 12:29:17 -04:00
|
|
|
{
|
|
|
|
test: /\.node$/,
|
|
|
|
use: ["node-loader"]
|
|
|
|
},
|
2017-05-25 21:40:46 +04:00
|
|
|
{
|
2017-06-09 22:03:02 -07:00
|
|
|
test: /\.css$/,
|
|
|
|
use: ["style-loader", "css-loader"]
|
2017-05-25 21:40:46 +04:00
|
|
|
},
|
2017-06-09 22:03:02 -07:00
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
2017-06-10 21:59:33 -07:00
|
|
|
loader: "babel-loader",
|
2017-06-09 22:03:02 -07:00
|
|
|
options: {
|
|
|
|
cacheDirectory: true,
|
2017-06-10 21:59:33 -07:00
|
|
|
presets: [ "es2015", "react", "stage-2" ]
|
2017-06-09 22:03:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-01-12 12:26:36 -06:00
|
|
|
]
|
|
|
|
},
|
2017-06-10 21:59:33 -07:00
|
|
|
target: "electron-main",
|
2017-06-09 22:03:02 -07:00
|
|
|
};
|