From be33afd1434cfd9fb8081379c16df1c06db220a4 Mon Sep 17 00:00:00 2001 From: snoop Date: Mon, 18 Dec 2017 17:06:05 +0900 Subject: [PATCH] added config --- config/webpack/webpack.config.base.js | 49 ++++++++++ config/webpack/webpack.config.dev.js | 101 ++++++++++++++++++++ config/webpack/webpack.config.prod.js | 71 ++++++++++++++ config/webpack/webpack.config.stats.js | 32 +++++++ public/asset/image/overFlow_CI_blue_180.png | Bin 0 -> 4150 bytes public/index.html | 22 +++++ 6 files changed, 275 insertions(+) create mode 100644 config/webpack/webpack.config.base.js create mode 100644 config/webpack/webpack.config.dev.js create mode 100644 config/webpack/webpack.config.prod.js create mode 100644 config/webpack/webpack.config.stats.js create mode 100644 public/asset/image/overFlow_CI_blue_180.png create mode 100644 public/index.html diff --git a/config/webpack/webpack.config.base.js b/config/webpack/webpack.config.base.js new file mode 100644 index 0000000..34cae75 --- /dev/null +++ b/config/webpack/webpack.config.base.js @@ -0,0 +1,49 @@ +const Path = require('path'); +const TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin; +const packages = require('../../package.json'); + +module.exports = { + target: 'web', + entry: { + app: [ + Path.resolve(__dirname, '../../src/ts/@overflow/app/index.tsx') + ], + vendor: Object.keys(packages.dependencies) + }, + + output: { + path: Path.resolve(__dirname, '../../dist'), + filename: '[name].js', + publicPath: '/' + }, + + devtool: '', + + resolve: { + extensions: ['.ts', '.tsx', '.js', '.json'], + plugins: [ + new TsConfigPathsPlugin({ + tsconfig: "tsconfig.json", + compiler: "typescript" + }) + ] + }, + + module: { + rules: [ + { + test: /\.tsx?$/, + enforce: 'pre', + exclude: [ + Path.resolve(__dirname, '../../node_modules/') + ], + loader: 'tslint-loader', + } + ] + }, + plugins: [ + ], + node: { + fs: 'empty' + } +}; diff --git a/config/webpack/webpack.config.dev.js b/config/webpack/webpack.config.dev.js new file mode 100644 index 0000000..fad9808 --- /dev/null +++ b/config/webpack/webpack.config.dev.js @@ -0,0 +1,101 @@ +const Path = require('path'); +const Webpack = require('webpack'); +const WebpackMerge = require('webpack-merge'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const WebpackDashboardPlugin = require('webpack-dashboard/plugin'); +const configBase = require('./webpack.config.base.js'); + +module.exports = WebpackMerge(configBase, { + entry: { + app: [ + 'react-hot-loader/patch' + ] + }, + + devtool: 'inline-source-map', + + devServer: { + hot: true, + inline: true, + historyApiFallback: true, + publicPath: '/', // match the output `publicPath` + contentBase: [__dirname + '/public', __dirname + '/dist', __dirname + '/node_modules'], // match the output path + host: '127.0.0.1', + port: 9091, + stats: { + colors: true + }, + watchOptions: { + ignored: /node_modules/, + }, + }, + + module: { + rules: [ + { + enforce: 'pre', + test: /\.js$/, + loader: 'source-map-loader', + exclude: [ + Path.resolve(__dirname, '../../node_modules/') + ] + }, + { + enforce: 'pre', + test: /\.tsx?$/, + use: "source-map-loader", + exclude: [ + Path.resolve(__dirname, '../../node_modules/') + ] + }, + // { + // test: /\.tsx?$/, + // loaders: [ + // 'awesome-typescript-loader' + // ], + // exclude: [ + // Path.resolve(__dirname, '../../node_modules/') + // ], + // include: [ + // Path.resolve(__dirname, '../../src/') + // ] + // }, + { + test: /\.tsx?$/, + exclude: [ + Path.resolve(__dirname, '../../node_modules/') + ], + include: [ + Path.resolve(__dirname, '../../src/') + ], + use: [ + { + loader: 'react-hot-loader/webpack' + }, + { + loader: 'awesome-typescript-loader', + options: { + transpileOnly: true, + useTranspileModule: false, + sourceMap: true, + }, + }, + ], + }, + ] + }, + plugins: [ + new WebpackDashboardPlugin(), + new Webpack.HotModuleReplacementPlugin(), + new Webpack.NamedModulesPlugin(), + new Webpack.NoEmitOnErrorsPlugin(), + new HtmlWebpackPlugin({ + template: Path.resolve(__dirname, '../../public/index.html') + }), + new Webpack.optimize.CommonsChunkPlugin({ + name: 'vendor', + minChunks: Infinity, + filename: 'vendor.js' + }), + ] +}); diff --git a/config/webpack/webpack.config.prod.js b/config/webpack/webpack.config.prod.js new file mode 100644 index 0000000..66fd666 --- /dev/null +++ b/config/webpack/webpack.config.prod.js @@ -0,0 +1,71 @@ +const Path = require('path'); +const Webpack = require('webpack'); +const WebpackMerge = require('webpack-merge'); +const configBase = require('./webpack.config.base.js'); + + +module.exports = WebpackMerge(configBase, { + devtool: 'source-map', + + module: { + rules: [ + { + enforce: 'pre', + test: /\.js$/, + loader: 'source-map-loader', + exclude: [ + Path.resolve(__dirname, '../../node_modules/') + ] + }, + { + test: /\.tsx?$/, + loader: 'awesome-typescript-loader', + exclude: [ + Path.resolve(__dirname, '../../node_modules/') + ] + }, + ] + }, + plugins: [ + new Webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('production') + }, + 'DEBUG': false, + '__DEVTOOLS__': false + }), + // Plugings for optimizing size and performance. + // Here you have all the available by now: + // Webpack 1. https://github.com/webpack/webpack/blob/v1.13.3/lib/optimize + // Webpack 2. https://github.com/webpack/webpack/tree/master/lib/optimize + new Webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false, + screw_ie8: true, + conditionals: true, + unused: true, + comparisons: true, + sequences: true, + dead_code: true, + evaluate: true, + if_return: true, + join_vars: true, + drop_console: true, + drop_debugger: true, + global_defs: { + __REACT_HOT_LOADER__: undefined // eslint-disable-line no-undefined + } + }, + minimize: true, + debug: false, + sourceMap: true, + output: { + comments: false + }, + + }), + // Included by default in webpack 2 + // new webpack.optimize.OccurrenceOrderPlugin(), + new Webpack.optimize.AggressiveMergingPlugin() + ] +}); diff --git a/config/webpack/webpack.config.stats.js b/config/webpack/webpack.config.stats.js new file mode 100644 index 0000000..6f894b6 --- /dev/null +++ b/config/webpack/webpack.config.stats.js @@ -0,0 +1,32 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// WebPack 2 STATS Config +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// +// REMEMBER UPLOAD YOUR stats.json to http://webpack.github.io/analyse/ +// IMPORTANT. If you use console.log in this file, the stats.json will not work... +// TODO. Include fileDateTime in stats.json as well. +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +const Visualizer = require('webpack-visualizer-plugin'); +const WebpackMerge = require('webpack-merge'); + +//////////////////////////////////////////////// +// File name for Visualizer +//////////////////////////////////////////////// +const currentDateTime = new Date(); +const currentDate = currentDateTime.toLocaleDateString('en-GB').replace(/\//g, "-"); +const currentTime = currentDateTime.toLocaleTimeString('en-GB', { hour12: false }).replace(/:/g, "-"); +const fileDateTime = currentDate + "-" + currentTime; +const statisticsFileName = './stats/statistics-' + fileDateTime + '.html'; +const configBase = require('./webpack.config.prod.js'); + + +module.exports = WebpackMerge(configBase, { + plugins: [ + new Visualizer({ + filename: statisticsFileName + }) + ] +}); diff --git a/public/asset/image/overFlow_CI_blue_180.png b/public/asset/image/overFlow_CI_blue_180.png new file mode 100644 index 0000000000000000000000000000000000000000..98833b772a8b4547c24065ab1ce40244789e4ab0 GIT binary patch literal 4150 zcmbVPc{o&k`=7DP&fAcRF-piXGm4CDh8f!!Tb5DCU_{JfW|*NYSt?lyAu41mQCSL! zEJayDBFXR|dkaFg=II^J^Yr|Fe>~UwUe|lBbI$jBzUTgYKKFfp@B6yWNwBxI5Zfic z3jhF!Sy`eTx#J`5r6450y~kT0spk%R7#KX`IK_{_B+!TelrP1b2(}^-P7@u81mCdW z4x%9d!0Q*_glFJ!HV7XINsF*!qs1aoxo7~u(1b-L_yiIeU~l5-0J0He@o5tT9N=pN zaXpHI;;3ds{{YKy8u56zt&>l9ppU*U#KahE$U<-lNJIt!%pwJm=?In)ON;wt1o3Aus0eLsCX=bf)X}2QPHV&T_4Ri+;BZZ@g(f|W z%pkBd$#msk3}_F_ct+_{#T;7Dbr>VsM;_s zs5XhT6W1TsbcQ4G|J?XTYr0bym8k7Vq*Fp@KHUBAQ~m|!=I%cW?HF>sLDPR4s%rq*m%^m0?QGAV(V~g8fKZ~ZIgLUB|B+ur zz(45!_qhMW`u;CD)8;y(y;B_juULL9aVv0V`giGbAO3D0BAMGUG;VABE`ONYouYnL zXp|G{!)JG4h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