This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends PureComponent<IProps, any> { | |
constructor(props: IProps) { | |
super(props) | |
this.state = { | |
isThrottled: false, | |
savedArgs: null, | |
timer: null | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------ | |
// RULES INJECTION! | |
// ------------------------------------ | |
const rules = [ | |
// PRELOAD CHECKING | |
{ | |
enforce: 'pre', | |
test: /\.(js|jsx)?$/, | |
exclude: /(node_modules|bower_components)/, | |
loader: 'eslint-loader', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import global vars for a whole app | |
require('./globals'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | |
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | |
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------ | |
// BUNDLES OPTIMIZATION | |
// ------------------------------------ | |
const optimization = { | |
optimization: { | |
splitChunks: { | |
chunks: 'all', | |
minChunks: 2 | |
}, | |
minimizer: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------ | |
// STAGE PLUGINS INJECTION! [DEVELOPMENT, PRODUCTION, TESTING] | |
// ------------------------------------ | |
const stagePlugins = { | |
test: [new BundleAnalyzerPlugin()], | |
development: [ | |
new HtmlWebpackPlugin({ | |
template: path.resolve('./src/index.html'), | |
filename: 'index.html', | |
inject: 'body', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createConfig = () => { | |
debug('Creating configuration.'); | |
debug(`Enabling devtools for '${__NODE_ENV__} Mode!'`); | |
const webpackConfig = { | |
mode: __DEV__ ? 'development' : 'production', | |
name: 'client', | |
target: 'web', | |
devtool: stageConfig[__NODE_ENV__].devtool, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import global vars for a whole app | |
require('../globals'); | |
const path = require('path'); | |
const browserSync = require('browser-sync'); | |
const historyApiFallback = require('connect-history-api-fallback'); | |
const webpack = require('webpack'); | |
const webpackDevMiddleware = require('webpack-dev-middleware'); | |
const webpackHotMiddleware = require('webpack-hot-middleware'); | |
const webpackConfig = require('../webpack.config.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ======================================================== | |
// WEBPACK MIDDLEWARE CONFIGURATION | |
// ======================================================== | |
const devMiddlewareOptions = { | |
publicPath: webpackConfig.output.publicPath, | |
hot: true, | |
headers: { 'Access-Control-Allow-Origin': '*' } | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ======================================================== | |
// Server Configuration | |
// ======================================================== | |
browserSync({ | |
open: false, | |
ghostMode: { | |
clicks: false, | |
forms: false, | |
scroll: true | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import global vars for a whole app | |
require('../globals'); | |
const debug = require('debug')('app:build:webpack-compiler'); | |
const webpack = require('webpack'); | |
const webpackConfig = require('../webpack.config.js'); |
OlderNewer