#207: add ga support

This commit is contained in:
SleepWalker
2016-10-09 21:23:00 +03:00
parent 666f5f218a
commit 3d98747c42
4 changed files with 46 additions and 25 deletions

View File

@@ -13,6 +13,13 @@ const vendor = Object.keys(require('./package.json').dependencies);
const rootPath = path.resolve('./src');
var config = {};
try {
config = require('./config/env.js');
} catch (err) {
console.error('\n\n===\nCan not find config/env.js. Running with defaults\n===\n\n', err);
}
/**
* TODO: https://babeljs.io/docs/plugins/
* TODO: отдельные конфиги для env (аля https://github.com/davezuko/react-redux-starter-kit)
@@ -110,7 +117,8 @@ var webpackConfig = {
inject: false,
minify: {
collapseWhitespace: isProduction
}
},
ga: config.ga
}),
new webpack.ProvidePlugin({
// window.fetch polyfill
@@ -237,32 +245,26 @@ if (isProduction) {
}
if (!isProduction && !isTest) {
var config;
try {
config = require('./config/dev.json');
} catch (err) {
console.error('\n\n===\nPlease create dev.json config under ./config based on template.dev.json\n===\n\n');
throw err;
}
webpackConfig.plugins.push(
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
);
webpackConfig.devServer = {
host: 'localhost',
port: 8080,
proxy: {
'/api': {
target: config.apiHost,
changeOrigin: true // add host http-header, based on target
}
},
hot: true,
inline: true,
historyApiFallback: true
};
if (config.apiHost) {
webpackConfig.devServer = {
host: 'localhost',
port: 8080,
proxy: {
'/api': {
target: config.apiHost,
changeOrigin: true // add host http-header, based on target
}
},
hot: true,
inline: true,
historyApiFallback: true
};
}
}
if (isDockerized) {