build additions

This commit is contained in:
Dennis Brown 2017-03-10 15:23:36 -06:00
parent 81836f744f
commit b94b3cc2ad
4 changed files with 2671 additions and 25 deletions

View File

@ -7,7 +7,9 @@
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "electron ./main",
"start": "electron ./main.prod",
"build": ""
"build-main": "cross-env NODE_ENV=production node -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.electron.js --progress --profile --colors",
"build-renderer": "cross-env NODE_ENV=production node -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.production.js --progress --profile --colors",
"build": "npm run build-main && npm run build-renderer"
},
"author": "DBrown",
"license": "ISC",
@ -16,5 +18,16 @@
"electron-debug": "^1.1.0",
"electron-devtools-installer": "^2.1.0",
"electron-prebuilt": "^1.4.13"
},
"devDependencies": {
"babel-core": "^6.23.1",
"babel-loader": "^6.4.0",
"babel-polyfill": "^6.23.0",
"babili-webpack-plugin": "^0.0.11",
"css-loader": "^0.27.1",
"file-loader": "^0.10.1",
"webpack": "^2.2.1",
"webpack-merge": "^4.0.0",
"webpack-validator": "^2.3.0"
}
}

40
webpack.config.base.js Normal file
View File

@ -0,0 +1,40 @@
/**
* Base webpack config used across other specific configs
*/
import path from 'path';
import validate from 'webpack-validator';
import { dependencies as externals } from './package.json';
export default validate({
module: {
loaders: [{
test: /\.jsx?$/,
loaders: ['babel-loader'],
exclude: /node_modules/
}, {
test: /\.json$/,
loader: 'json-loader'
}]
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
// https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2'
},
/**
* Determine the array of extensions that should be used to resolve modules.
*/
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main']
},
plugins: [],
externals: Object.keys(externals || {})
});

View File

@ -0,0 +1,62 @@
/**
* Build config for electron 'Main Process' file
*/
import webpack from 'webpack';
import validate from 'webpack-validator';
import merge from 'webpack-merge';
import BabiliPlugin from 'babili-webpack-plugin';
import baseConfig from './webpack.config.base';
export default validate(merge(baseConfig, {
devtool: 'source-map',
entry: ['babel-polyfill', './App/main.development'],
// 'main.js' in root
output: {
path: __dirname,
filename: './App/main.js'
},
plugins: [
/**
* Babli is an ES6+ aware minifier based on the Babel toolchain (beta)
*/
new BabiliPlugin({
// Disable deadcode until https://github.com/babel/babili/issues/385 fixed
deadcode: false,
}),
/**
* Create global constants which can be configured at compile time.
*
* Useful for allowing different behaviour between development builds and
* release builds
*
* NODE_ENV should be production so that modules do not perform certain
* development checks
*/
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
],
/**
* Set target to Electron specific node.js env.
* https://github.com/chentsulin/webpack-target-electron-renderer#how-this-module-works
*/
target: 'electron-main',
/**
* Disables webpack processing of __dirname and __filename.
* If you run the bundle in node.js it falls back to these values of node.js.
* https://github.com/webpack/webpack/issues/2010
*/
node: {
__dirname: false,
__filename: false
},
}));

2579
yarn.lock

File diff suppressed because it is too large Load Diff