whitelisted moment.js locales to reduce bundle size

This commit is contained in:
Alec Merdler 2017-08-02 11:26:36 -04:00
parent 82a08a942e
commit 6dae6c4f82
6 changed files with 13 additions and 19 deletions

View file

@ -24,6 +24,9 @@ from _init import __version__
logger = logging.getLogger(__name__)
JS_BUNDLE_NAME = 'bundle'
def common_login(user_uuid, permanent_session=True):
""" Performs login of the given user, with optional non-permanence on the session. """
user = model.get_user(user_uuid)
@ -71,10 +74,7 @@ def _list_files(path, extension, contains=""):
def render_page_template(name, route_data=None, **kwargs):
""" Renders the page template with the given name as the response and returns its contents. """
library_styles = []
main_styles = []
library_scripts = []
main_scripts = _list_files('build', 'js', "bundle")
main_scripts = _list_files('build', 'js', JS_BUNDLE_NAME)
use_cdn = app.config.get('USE_CDN', True)
if request.args.get('use_cdn') is not None:
@ -118,10 +118,7 @@ def render_page_template(name, route_data=None, **kwargs):
route_data=route_data,
external_styles=external_styles,
external_scripts=external_scripts,
main_styles=main_styles,
library_styles=library_styles,
main_scripts=main_scripts,
library_scripts=library_scripts,
feature_set=features.get_features(),
config_set=frontend_visible_config(app.config),
oauth_set=get_oauth_config(),

View file

@ -4,6 +4,7 @@ import { NAME_PATTERNS } from "./constants/name-patterns.constant";
import * as Raven from "raven-js";
var quayDependencies: string[] = [
'chieffancypants.loadingBar',
'cfp.hotkeys',

View file

@ -1,3 +1,6 @@
import * as Raven from 'raven-js';
/**
* Service which monitors the current user session and provides methods for returning information
* about the user.

View file

@ -22,14 +22,6 @@
<meta property="og:image" content="{{ preferred_scheme }}://{{ hostname }}/static/img/quay_preview.png" />
<!-- /Icons -->
{% for style_path in main_styles %}
<link rel="stylesheet" href="/static/{{ style_path }}" type="text/css">
{% endfor %}
{% for style_path in library_styles %}
<link rel="stylesheet" href="/static/{{ style_path }}" type="text/css">
{% endfor %}
{% block added_stylesheets %}
{% endblock %}
@ -57,10 +49,6 @@
<script src="{{ script_url }}"></script>
{% endfor %}
{% for script_path in library_scripts %}
<script src="/static/{{ script_path }}"></script>
{% endfor %}
{% block added_dependencies %}
{% endblock %}

Binary file not shown.

View file

@ -17,6 +17,8 @@ let config = {
externals: {
angular: "angular",
jquery: "$",
moment: "moment",
"raven-js": "Raven",
},
module: {
rules: [
@ -47,7 +49,10 @@ let config = {
FileSaver: 'file-saver',
angular: "angular",
$: "jquery",
moment: "moment",
}),
// Restrict the extra locales that moment.js can load; en is always included
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
],
devtool: "cheap-module-source-map",
};