fix(electron): fix electron build (fix #407, fix #429)

This commit is contained in:
ESadouski 2016-11-18 18:27:35 +03:00 committed by Dmitry Nehaychik
parent 2108067aab
commit 8887516c44
2 changed files with 20 additions and 17 deletions

View file

@ -18,14 +18,14 @@ module.exports = {
},
resolve: {
extensions: ['', '.ts', '.js', '.json']
extensions: ['.ts', '.js', '.json']
},
module: {
loaders: [
rules: [
{
test: /\.ts$/,
loader: 'awesome-typescript-loader'
loaders: 'awesome-typescript-loader'
}
]
},
@ -35,4 +35,4 @@ module.exports = {
from: 'src/package.json'
}])
]
}
};

View file

@ -1,9 +1,9 @@
const helpers = require('./../helpers');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const METADATA = {
baseUrl: './',
ENV: 'renderer',
ENV: 'renderer'
};
/*
@ -14,17 +14,10 @@ const METADATA = {
module.exports = function (env) {
METADATA.ENV = env
? env
: METADATA.ENV
: METADATA.ENV;
return {
/*
* Static metadata for index.html
*
* See: (custom attribute)
*/
metadata: METADATA,
/**
* The plataform target where the aplication is going to run in.
* It support target electron-renderer, but is not documented.
@ -46,7 +39,7 @@ module.exports = function (env) {
*
* See: http://webpack.github.io/docs/configuration.html#output-path
*/
path: helpers.root('build'),
path: helpers.root('build')
},
/*
@ -56,12 +49,22 @@ module.exports = function (env) {
* See: https://webpack.github.io/docs/configuration.html#node
*/
node: {
global: 'window',
global: true,
crypto: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html',
title: METADATA.title,
chunksSortMode: 'dependency',
metadata: METADATA,
inject: 'head'
})
]
};
};