Improve prod build. Add screenshot to readme.

This commit is contained in:
Tyler Hallada 2018-04-16 17:52:07 -04:00
parent df9ba6d5ea
commit f663e23bc9
4 changed files with 26 additions and 3 deletions

View File

@ -1,6 +1,9 @@
# Transport
A generative art project in progress.
Work-in-progress procedurally generated train network simulation written in
Typescript with PixiJs.
![Screenshot of simulation](img/screenshot.png)
## Development

BIN
img/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

View File

@ -38,6 +38,7 @@
"tslint": "^5.9.1",
"tslint-config-airbnb": "^5.8.0",
"typescript": "^2.8.1",
"uglifyjs-webpack-plugin": "^1.2.4",
"webpack": "^4.4.1",
"webpack-cli": "^2.0.13",
"webpack-dev-server": "^3.1.1"

View File

@ -1,13 +1,20 @@
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const env = process.env.NODE_ENV;
const prodPlugins = env === 'production' ? [
new UglifyJsPlugin({
sourceMap: true,
}),
] : [];
module.exports = {
entry: './src/transport.ts',
output: {
filename: 'transport.js',
filename: env === 'production' ? '[name].min.js' : '[name].js',
path: path.resolve(__dirname, 'dist'),
},
mode: env === 'production' ? 'production' : 'development',
@ -61,8 +68,20 @@ module.exports = {
disable: env === 'development',
filename: '[name].css',
}),
...prodPlugins,
],
devtool: 'cheap-module-eval-source-map',
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
},
devtool: env === 'production' ? 'source-map' : 'cheap-module-eval-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
host: '0.0.0.0',