mirror of
https://github.com/MutableLoss/6502SimDesktop.git
synced 2024-07-25 08:29:11 +00:00
build additions
This commit is contained in:
parent
81836f744f
commit
b94b3cc2ad
15
package.json
15
package.json
@ -7,7 +7,9 @@
|
|||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"dev": "electron ./main",
|
"dev": "electron ./main",
|
||||||
"start": "electron ./main.prod",
|
"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",
|
"author": "DBrown",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
@ -16,5 +18,16 @@
|
|||||||
"electron-debug": "^1.1.0",
|
"electron-debug": "^1.1.0",
|
||||||
"electron-devtools-installer": "^2.1.0",
|
"electron-devtools-installer": "^2.1.0",
|
||||||
"electron-prebuilt": "^1.4.13"
|
"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
40
webpack.config.base.js
Normal 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 || {})
|
||||||
|
});
|
62
webpack.config.electron.js
Normal file
62
webpack.config.electron.js
Normal 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
|
||||||
|
},
|
||||||
|
}));
|
Loading…
Reference in New Issue
Block a user