Don't webpack electron main, separate electron

* Don't webpack electron-main.js: no need to webpack in electron
 * Keep the electron file separate from the webapp, in their own
   'electron' directory
This commit is contained in:
David Baker 2016-10-19 17:18:35 +01:00
parent 976c20a2f7
commit 2026142595
4 changed files with 9 additions and 44 deletions

View file

@ -2,8 +2,7 @@ var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = [{
entry: './src/vector/index.js',
module.exports = {
module: {
preLoaders: [
{ test: /\.js$/, loader: "source-map-loader" }
@ -33,9 +32,7 @@ module.exports = [{
// various levels of '.' and '..'
// Also, sometimes the resource path is absolute.
return path.relative(process.cwd(), info.resourcePath).replace(/^[\/\.]*/, '');
},
path: './vector/',
filename: 'bundle.js'
}
},
resolve: {
alias: {
@ -55,7 +52,6 @@ module.exports = [{
// loads it into the browser global `Olm`), and reference it as an
// external here.
"olm": "Olm",
"electron": 'commonjs electron'
},
plugins: [
new webpack.DefinePlugin({
@ -69,33 +65,4 @@ module.exports = [{
}),
],
devtool: 'source-map'
}, {
entry: './src/electron-main.js',
target: "electron",
output: {
devtoolModuleFilenameTemplate: function(info) {
// Reading input source maps gives only relative paths here for
// everything. Until I figure out how to fix this, this is a
// workaround.
// We use the relative resource path with any '../'s on the front
// removed which gives a tree with matrix-react-sdk and vector
// trees smashed together, but this fixes everything being under
// various levels of '.' and '..'
// Also, sometimes the resource path is absolute.
return path.relative(process.cwd(), info.resourcePath).replace(/^[\/\.]*/, '');
},
filename: 'vector/electron-main.js'
},
node: {
__dirname: false,
__filename: false
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
],
devtool: 'source-map',
}];
};