mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-01-13 23:32:15 +05:30
Включил HMR
This commit is contained in:
parent
86e691491a
commit
900dac850e
@ -35,6 +35,7 @@
|
|||||||
"babel-plugin-transform-runtime": "^6.3.13",
|
"babel-plugin-transform-runtime": "^6.3.13",
|
||||||
"babel-preset-es2015": "^6.3.13",
|
"babel-preset-es2015": "^6.3.13",
|
||||||
"babel-preset-react": "^6.3.13",
|
"babel-preset-react": "^6.3.13",
|
||||||
|
"babel-preset-react-hmre": "^1.0.1",
|
||||||
"babel-preset-stage-0": "^6.3.13",
|
"babel-preset-stage-0": "^6.3.13",
|
||||||
"babel-runtime": "^5.6.15",
|
"babel-runtime": "^5.6.15",
|
||||||
"chai": "^3.0.0",
|
"chai": "^3.0.0",
|
||||||
|
@ -10,10 +10,15 @@ var iconfontImporter = require('./webpack/node-sass-iconfont-importer');
|
|||||||
|
|
||||||
const API_HOST = 'http://account.l';
|
const API_HOST = 'http://account.l';
|
||||||
|
|
||||||
// TODO: https://babeljs.io/docs/plugins/
|
/**
|
||||||
// TODO: отдельные конфиги для env (аля https://github.com/davezuko/react-redux-starter-kit)
|
* TODO: https://babeljs.io/docs/plugins/
|
||||||
// https://github.com/glenjamin/ultimate-hot-reloading-example ( обратить внимание на плагины babel )
|
* TODO: отдельные конфиги для env (аля https://github.com/davezuko/react-redux-starter-kit)
|
||||||
// https://github.com/gajus/react-css-modules ( + BrowserSync)
|
* https://github.com/glenjamin/ultimate-hot-reloading-example ( обратить внимание на плагины babel )
|
||||||
|
* https://github.com/gajus/react-css-modules ( + BrowserSync)
|
||||||
|
*
|
||||||
|
* Inspiration projects:
|
||||||
|
* https://github.com/davezuko/react-redux-starter-kit
|
||||||
|
*/
|
||||||
|
|
||||||
var isProduction = process.argv.some(function(arg) {
|
var isProduction = process.argv.some(function(arg) {
|
||||||
return arg === '-p';
|
return arg === '-p';
|
||||||
@ -69,7 +74,7 @@ var webpackConfig = {
|
|||||||
new iconfontImporter.Plugin(),
|
new iconfontImporter.Plugin(),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
NODE_ENV: JSON.stringify(isProduction ? 'production' : 'dev')
|
NODE_ENV: JSON.stringify(isProduction ? 'production' : 'development')
|
||||||
},
|
},
|
||||||
__DEV__: !isProduction,
|
__DEV__: !isProduction,
|
||||||
__TEST__: isTest,
|
__TEST__: isTest,
|
||||||
@ -105,7 +110,12 @@ var webpackConfig = {
|
|||||||
loader: 'babel',
|
loader: 'babel',
|
||||||
query: {
|
query: {
|
||||||
presets: ['react', 'es2015', 'stage-0'],
|
presets: ['react', 'es2015', 'stage-0'],
|
||||||
plugins: ['transform-runtime', ['react-intl', {messagesDir: './dist/messages/'}]]
|
plugins: ['transform-runtime', ['react-intl', {messagesDir: './dist/messages/'}]],
|
||||||
|
env: {
|
||||||
|
development: {
|
||||||
|
presets: ['react-hmre']
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -136,7 +146,7 @@ var webpackConfig = {
|
|||||||
|
|
||||||
|
|
||||||
if (isProduction) {
|
if (isProduction) {
|
||||||
webpackConfig.module.loaders.forEach(function(loader) {
|
webpackConfig.module.loaders.forEach((loader) => {
|
||||||
if (loader.extractInProduction) {
|
if (loader.extractInProduction) {
|
||||||
var parts = loader.loader.split('!');
|
var parts = loader.loader.split('!');
|
||||||
loader.loader = ExtractTextPlugin.extract(parts[0], parts.slice(1).join('!'));
|
loader.loader = ExtractTextPlugin.extract(parts[0], parts.slice(1).join('!'));
|
||||||
@ -150,4 +160,11 @@ if (isProduction) {
|
|||||||
webpackConfig.devtool = false;
|
webpackConfig.devtool = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isProduction && !isTest) {
|
||||||
|
webpackConfig.plugins.push(
|
||||||
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
|
new webpack.NoErrorsPlugin()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = webpackConfig;
|
module.exports = webpackConfig;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user