-
-
Save b2whats/b3611fd12230e7d63501 to your computer and use it in GitHub Desktop.
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
/*eslint-disable no-console, radix*/ | |
import webpack from 'webpack'; | |
import path from 'path'; | |
import writeStats from './writeStats'; | |
import ExtractTextPlugin from 'extract-text-webpack-plugin'; | |
import CleanPlugin from 'clean-webpack-plugin'; | |
import autoprefixer from 'autoprefixer-core'; | |
import webpackStripLoader from 'strip-loader'; | |
import { host, webpackPort, buildDir } from '../config'; | |
const argv = require('minimist')(process.argv.slice(2)); | |
const DEBUG = !argv.production; | |
const notExclude = [].join('|'); | |
const EXCLUDE_JS = notExclude !== '' ? new RegExp('node_modules/(?!' + notExclude + ')') : new RegExp('node_modules'); | |
const JSX_LOADER = DEBUG ? ['react-hot', 'babel'] : [webpackStripLoader.loader('console.log'), 'babel']; | |
const CSS_LOADER = ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]-[local]!postcss'); | |
const AUTOPREFIXER_BROWSERS = [ | |
'Android 2.3', | |
'Android >= 4', | |
'Chrome >= 20', | |
'Firefox >= 24', | |
'Explorer >= 8', | |
'iOS >= 6', | |
'Opera >= 12', | |
'Safari >= 6' | |
]; | |
const PLUGINS = [ | |
DEBUG && new webpack.HotModuleReplacementPlugin(), | |
DEBUG && new webpack.IgnorePlugin(/\.json$/), | |
!DEBUG && new CleanPlugin(['build'], path.resolve(__dirname, '..')), | |
!DEBUG && new webpack.DefinePlugin({ | |
'process.env': { | |
NODE_ENV: JSON.stringify('production') | |
} | |
}), | |
!DEBUG && new webpack.optimize.DedupePlugin(), | |
!DEBUG && new webpack.optimize.UglifyJsPlugin({ | |
compress: { | |
warnings: false | |
} | |
}), | |
new ExtractTextPlugin('[name]-[chunkhash].css', {allChunks: true, disable: DEBUG}), | |
new webpack.optimize.OccurenceOrderPlugin(), | |
new webpack.NoErrorsPlugin(), | |
new webpack.DefinePlugin({ | |
__CLIENT__: true, | |
__SERVER__: false, | |
__DEVELOPMENT__: DEBUG ? true : false, | |
__DEVTOOLS__: false | |
}), | |
function write() { | |
this.plugin('done', stats => { | |
let type = DEBUG ? 'dev' : 'prod'; | |
writeStats.call(this, stats, type); | |
}); | |
} | |
]; | |
const config = { | |
devtool: DEBUG ? 'eval-source-map' : 'source-map', | |
entry: { | |
'main': ['./src/client.js'].concat(!DEBUG ? [] : [ | |
`webpack-dev-server/client?http://${host}:${webpackPort}`, | |
'webpack/hot/only-dev-server' | |
]) | |
}, | |
cache: DEBUG, | |
debug: false, | |
output: { | |
path: buildDir, | |
filename: 'client.js', | |
publicPath: DEBUG ? `http://${host}:${webpackPort}/webPackDevServer/` : './' | |
}, | |
module: { | |
loaders: [ | |
{ test: /\.(jpe?g|png|gif|svg)$/, loader: 'file' }, | |
{ test: /\.jsx?$/, exclude: EXCLUDE_JS, loaders: JSX_LOADER}, | |
{ test: /\.json$/, loader: 'json-loader' }, | |
{ test: /\.css$/, loader: CSS_LOADER } | |
] | |
}, | |
postcss: [autoprefixer(AUTOPREFIXER_BROWSERS)], | |
resolve: { | |
modulesDirectories: ['src', 'node_modules'], | |
extensions: ['', '.json', '.js', '.jsx'] | |
}, | |
plugins: PLUGINS.filter(plugin => plugin !== false) | |
}; | |
export default config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
============ Vim =============
Включить номера строк
echo "set number" >> ~/.vimrc или разовое использование при редактировании файла :set number
дублировать текущую строку
y+y или Y - скопировать текущую строку
p - вставить после текущей строки
Р - вставить до текущей строку
Отмена предыдущего действия
u
Отменить отмену
ctrl+R
Удалить текущую строку
dd или S но сразу перейти в режим редактирования