Merge pull request #491 from rschamp/bugfix/common-chunk-fallout

Fix fallout from common chunk refactor
This commit is contained in:
Ray Schamp 2016-05-17 23:17:06 -04:00
commit b1be409dea
11 changed files with 68 additions and 57 deletions

5
polyfill/b64.min.js vendored
View file

@ -1,5 +0,0 @@
/*!
* https://github.com/davidchambers/Base64.js
* see https://github.com/davidchambers/Base64.js/blob/master/LICENSE
*/
!function(){function t(t){this.message=t}var r="undefined"!=typeof exports?exports:this,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d="";a.charAt(0|i)||(c="=",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(n=a.charCodeAt(i+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}();

View file

@ -1,6 +0,0 @@
/*!
* https://github.com/krambuhl/custom-event-polyfill
* @license The MIT License (MIT) Copyright (c) 2014 Evan Krambuhl
* see https://github.com/krambuhl/custom-event-polyfill/blob/master/LICENSE
*/
(function(){try{new e("test")}catch(t){var e=function(t,e){var n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},n=document.createEvent("CustomEvent"),n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n};e.prototype=window.Event.prototype,window.CustomEvent=e}})();

File diff suppressed because one or more lines are too long

View file

@ -1,6 +0,0 @@
/*!
* https://github.com/paulirish/matchMedia.js
* @license Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license
* see https://github.com/paulirish/matchMedia.js/blob/master/LICENSE.txt
*/
(function(){window.matchMedia||(window.matchMedia=function(){"use strict";var e=window.styleMedia||window.media;if(!e){var t=document.createElement("style"),i=document.getElementsByTagName("script")[0],n=null;t.type="text/css",t.id="matchmediajs-test",i.parentNode.insertBefore(t,i),n="getComputedStyle"in window&&window.getComputedStyle(t,null)||t.currentStyle,e={matchMedium:function(e){var i="@media "+e+"{ #matchmediajs-test { width: 1px; } }";return t.styleSheet?t.styleSheet.cssText=i:t.textContent=i,"1px"===n.width}}}return function(t){return{matches:e.matchMedium(t||"all"),media:t||"all"}}}());})();

View file

@ -1,5 +1,16 @@
var jar = require('./lib/jar');
var Raven = require('raven-js');
/**
* -----------------------------------------------------------------------------
* Error handling
* -----------------------------------------------------------------------------
*/
(function () {
if (process.env.SENTRY_DSN !== '') {
Raven.config(process.env.SENTRY_DSN).install();
}
})();
/**
* -----------------------------------------------------------------------------

View file

@ -1,12 +1,21 @@
var requireAll = require('./require-all');
var ReactIntl = require('react-intl');
var customLanguages = require('../../custom-locales.json');
var allLocaleData = requireAll(require.context('react-intl/locale-data', true, /^\.\/.*\.js$/));
var customLocaleData = require('../../custom-locales.json');
/**
* Add all locales
*/
for (var locale in allLocaleData) {
ReactIntl.addLocaleData(allLocaleData[locale]);
}
/**
* Add custom locales to react-intl if it doesn't have them.
*/
for (var locale in customLanguages) {
ReactIntl.addLocaleData(customLanguages[locale]);
for (var customLocale in customLocaleData) {
ReactIntl.addLocaleData(customLocaleData[customLocale]);
}
module.exports = ReactIntl;

5
src/lib/require-all.js Normal file
View file

@ -0,0 +1,5 @@
var requireAll = function (requireContext) {
return requireContext.keys().map(requireContext);
};
module.exports = requireAll;

View file

@ -19,14 +19,5 @@ module.exports = {
og_image_height: 860,
// Analytics & Monitoring
ga_tracker: process.env.GA_TRACKER || '',
// Error handling
sentry_dsn: process.env.SENTRY_DSN || '',
// Use minified JS libraries
min: (process.env.NODE_ENV === 'production') ? '.min' : '',
// Redux likes to have this
NODE_ENV: process.env.NODE_ENV
ga_tracker: process.env.GA_TRACKER || ''
};

View file

@ -38,6 +38,8 @@
};
</script>
<!-- Polyfills -->
<script src="/js/polyfill.min.js"></script>
</head>
<body>
@ -49,13 +51,6 @@
<script src="/js/{{name}}.intl.js"></script>
<script src="/js/{{name}}.bundle.js"></script>
<!-- Error logging (Sentry) -->
<script>
if ('{{&sentry_dsn}}' !== '') {
Raven.config('{{&sentry_dsn}}').install();
}
</script>
<!-- Analytics (GA) -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

File diff suppressed because one or more lines are too long

View file

@ -36,12 +36,6 @@ VersionPlugin.prototype.apply = function (compiler) {
// Prepare all entry points
var entry = {
common: [
// Polyfills
'./polyfill/b64.min.js',
'./polyfill/custom-event.min.js',
'./polyfill/es5-shim.min.js',
'./polyfill/intl.min.js',
'./polyfill/match-media.min.js',
// Vendor
'raven-js',
'react',
@ -110,7 +104,8 @@ module.exports = {
}
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"' + process.env.NODE_ENV + '"'
'process.env.NODE_ENV': '"' + (process.env.NODE_ENV || 'development') + '"',
'process.env.SENTRY_DSN': '"' + (process.env.SENTRY_DSN || '') + '"'
}),
new webpack.optimize.CommonsChunkPlugin('common', 'js/common.bundle.js'),
new webpack.optimize.OccurenceOrderPlugin()