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:
parent
976c20a2f7
commit
2026142595
4 changed files with 9 additions and 44 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,10 +5,8 @@
|
|||
/node_modules
|
||||
/packages/
|
||||
/vector/bundle.*
|
||||
/vector/electron-main.*
|
||||
/vector/components.css
|
||||
/vector/emojione/
|
||||
/vector/electron/
|
||||
/vector/config.json
|
||||
/vector/olm.js
|
||||
.DS_Store
|
||||
|
|
|
@ -5,9 +5,9 @@ let window = null;
|
|||
|
||||
app.on('ready', () => {
|
||||
window = new BrowserWindow({
|
||||
icon: `${__dirname}/img/logo.png`,
|
||||
icon: `${__dirname}/../../vector/img/logo.png`,
|
||||
});
|
||||
window.loadURL(`file://${__dirname}/index.html`);
|
||||
window.loadURL(`file://${__dirname}/../../vector/index.html`);
|
||||
window.on('closed', () => {
|
||||
window = null;
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "vector-web",
|
||||
"productName": "Riot",
|
||||
"main": "vector/electron-main.js",
|
||||
"main": "electron/src/electron-main.js",
|
||||
"version": "0.8.3",
|
||||
"description": "Vector webapp",
|
||||
"author": "matrix.org",
|
||||
|
@ -18,7 +18,7 @@
|
|||
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
||||
"build:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css --no-watch",
|
||||
"build:compile": "babel --source-maps -d lib src",
|
||||
"build:bundle": "NODE_ENV=production webpack",
|
||||
"build:bundle": "NODE_ENV=production webpack -p lib/vector/index.js vector/bundle.js",
|
||||
"build:bundle:dev": "webpack --optimize-occurence-order lib/vector/index.js vector/bundle.js",
|
||||
"build:staticfiles": "cpx -v node_modules/olm/olm.js vector/",
|
||||
"build:electron": "build -lwm",
|
||||
|
@ -26,8 +26,8 @@
|
|||
"build:dev": "npm run build:staticfiles && npm run build:emojione && npm run build:css && npm run build:compile && npm run build:bundle:dev",
|
||||
"package": "scripts/package.sh",
|
||||
"start:emojione": "cpx \"node_modules/emojione/assets/svg/*\" vector/emojione/svg/ -w",
|
||||
"start:js": "webpack -w",
|
||||
"start:js:prod": "NODE_ENV=production webpack -w",
|
||||
"start:js": "webpack -w src/vector/index.js vector/bundle.js",
|
||||
"start:js:prod": "NODE_ENV=production webpack -w src/vector/index.js vector/bundle.js",
|
||||
"start:skins:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css",
|
||||
"start:staticfiles": "cpx -Lwv node_modules/olm/olm.js vector/",
|
||||
"//cache": "Note the -c 1 below due to https://code.google.com/p/chromium/issues/detail?id=508270",
|
||||
|
|
|
@ -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',
|
||||
}];
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue