Configure electron-webpack

This commit is contained in:
Igor Gassmann 2017-12-04 16:45:18 -03:00
parent 127b7733bc
commit 6982fc5647
2 changed files with 28 additions and 0 deletions

5
electron-webpack.json Normal file
View file

@ -0,0 +1,5 @@
{
"renderer": {
"webpackConfig": "webpack.renderer.additions.js"
}
}

View file

@ -0,0 +1,23 @@
const path = require('path');
const ELECTRON_RENDERER_PROCESS_ROOT = path.resolve(__dirname, 'src/renderer/');
module.exports = {
// This rule is temporarily necessary until https://github.com/electron-userland/electron-webpack/issues/60 is fixed.
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
options: {
presets: ['env', 'react', 'stage-2']
}
}
]
},
// This allows imports to be made from the renderer process root (https://moduscreate.com/blog/es6-es2015-import-no-relative-path-webpack/).
resolve: {
modules: [ELECTRON_RENDERER_PROCESS_ROOT, 'node_modules', __dirname],
extensions: ['.js', '.jsx', '.scss']
}
};