2016-11-22 21:19:08 +01:00
|
|
|
const path = require('path');
|
2017-05-23 09:41:26 +02:00
|
|
|
const webpack = require('webpack')
|
2017-04-07 07:15:22 +02:00
|
|
|
const appPath = path.resolve(__dirname, 'js');
|
2016-11-22 21:19:08 +01:00
|
|
|
|
|
|
|
const PATHS = {
|
|
|
|
app: path.join(__dirname, 'app'),
|
|
|
|
dist: path.join(__dirname, 'dist')
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
2017-01-01 04:56:03 +01:00
|
|
|
entry: ['babel-polyfill', './js/main.js'],
|
2016-11-22 21:19:08 +01:00
|
|
|
output: {
|
2017-01-26 18:40:44 +01:00
|
|
|
path: path.join(PATHS.dist, 'js'),
|
2016-11-22 22:07:23 +01:00
|
|
|
publicPath: '/js/',
|
2016-11-22 21:19:08 +01:00
|
|
|
filename: "bundle.js"
|
|
|
|
},
|
|
|
|
devtool: 'source-map',
|
2017-04-07 07:15:22 +02:00
|
|
|
resolve: {
|
2017-06-10 07:13:11 +02:00
|
|
|
modules: [appPath, "node_modules"],
|
|
|
|
extensions: ['.js', '.jsx', '.css']
|
2017-04-07 07:15:22 +02:00
|
|
|
},
|
2017-05-23 09:41:26 +02:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
2017-05-25 16:52:30 +02:00
|
|
|
ENV: JSON.stringify("production"),
|
2017-05-23 09:41:26 +02:00
|
|
|
}),
|
|
|
|
],
|
2016-11-22 21:19:08 +01:00
|
|
|
module: {
|
2017-06-10 07:13:11 +02:00
|
|
|
rules: [
|
2016-11-22 21:19:08 +01:00
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
2017-06-10 07:13:11 +02:00
|
|
|
enforce: "pre",
|
2016-11-22 21:19:08 +01:00
|
|
|
loaders: ['eslint'],
|
|
|
|
// define an include so we check just the files we need
|
|
|
|
include: PATHS.app
|
2017-05-25 19:40:46 +02:00
|
|
|
},
|
|
|
|
{
|
2017-06-10 07:13:11 +02:00
|
|
|
test: /\.css$/,
|
|
|
|
use: ["style-loader", "css-loader"]
|
2017-05-25 19:40:46 +02:00
|
|
|
},
|
2017-06-10 07:13:11 +02:00
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
cacheDirectory: true,
|
|
|
|
presets: [ 'es2015', 'react', 'stage-2' ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-11-22 21:19:08 +01:00
|
|
|
]
|
2017-01-19 10:50:08 +01:00
|
|
|
},
|
|
|
|
target: 'electron-main',
|
2017-06-10 07:03:02 +02:00
|
|
|
};
|