added config
This commit is contained in:
parent
ff19777317
commit
be33afd143
49
config/webpack/webpack.config.base.js
Normal file
49
config/webpack/webpack.config.base.js
Normal file
|
@ -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'
|
||||
}
|
||||
};
|
101
config/webpack/webpack.config.dev.js
Normal file
101
config/webpack/webpack.config.dev.js
Normal file
|
@ -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'
|
||||
}),
|
||||
]
|
||||
});
|
71
config/webpack/webpack.config.prod.js
Normal file
71
config/webpack/webpack.config.prod.js
Normal file
|
@ -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()
|
||||
]
|
||||
});
|
32
config/webpack/webpack.config.stats.js
Normal file
32
config/webpack/webpack.config.stats.js
Normal file
|
@ -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
|
||||
})
|
||||
]
|
||||
});
|
BIN
public/asset/image/overFlow_CI_blue_180.png
Normal file
BIN
public/asset/image/overFlow_CI_blue_180.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
22
public/index.html
Normal file
22
public/index.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Hello React!</title>
|
||||
<!--[if lte IE 9]>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.0/es6-promise.auto.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link>
|
||||
<style type="text/css">
|
||||
.fullHeight {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="appContainer" class="fullHeight"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user