mirror of https://github.com/zulip/zulip.git
webpack: Move app_debug.js to webpack bundle.
This commit is contained in:
parent
04626acd5a
commit
1e5ce918e3
|
@ -1,6 +1,10 @@
|
||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"node": true
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"$": false,
|
"$": false,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"main": "",
|
"main": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"clipboard": "1.5.16",
|
"clipboard": "1.5.16",
|
||||||
|
"expose-loader": "0.7.3",
|
||||||
"handlebars": "4.0.6",
|
"handlebars": "4.0.6",
|
||||||
"i18next": "3.4.4",
|
"i18next": "3.4.4",
|
||||||
"i18next-browser-languagedetector": "0.3.0",
|
"i18next-browser-languagedetector": "0.3.0",
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
not put sensitive information here. */
|
not put sensitive information here. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
print_elapsed_time("foo", foo)
|
debug.print_elapsed_time("foo", foo)
|
||||||
|
|
||||||
evaluates to foo() and prints the elapsed time
|
evaluates to foo() and prints the elapsed time
|
||||||
to the console along with the name "foo". */
|
to the console along with the name "foo". */
|
||||||
|
|
||||||
function print_elapsed_time(name, fun) {
|
export function print_elapsed_time(name, fun) {
|
||||||
var t0 = new Date().getTime();
|
var t0 = new Date().getTime();
|
||||||
var out = fun();
|
var out = fun();
|
||||||
var t1 = new Date().getTime();
|
var t1 = new Date().getTime();
|
||||||
|
@ -23,7 +23,7 @@ function print_elapsed_time(name, fun) {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_duplicate_ids() {
|
export function check_duplicate_ids() {
|
||||||
var ids = {};
|
var ids = {};
|
||||||
var collisions = [];
|
var collisions = [];
|
||||||
var total_collisions = 0;
|
var total_collisions = 0;
|
||||||
|
@ -66,7 +66,7 @@ function check_duplicate_ids() {
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* var ip = new IterationProfiler();
|
* var ip = new debug.IterationProfiler();
|
||||||
* _.each(myarray, function (elem) {
|
* _.each(myarray, function (elem) {
|
||||||
* ip.iteration_start();
|
* ip.iteration_start();
|
||||||
*
|
*
|
||||||
|
@ -89,7 +89,7 @@ function check_duplicate_ids() {
|
||||||
* The _rest_of_iteration section is the region of the iteration body
|
* The _rest_of_iteration section is the region of the iteration body
|
||||||
* after section b.
|
* after section b.
|
||||||
*/
|
*/
|
||||||
function IterationProfiler() {
|
export function IterationProfiler() {
|
||||||
this.sections = {};
|
this.sections = {};
|
||||||
this.last_time = window.performance.now();
|
this.last_time = window.performance.now();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,6 @@ var page_params = {{ page_params }};
|
||||||
|
|
||||||
{{ render_bundle('translations') }}
|
{{ render_bundle('translations') }}
|
||||||
|
|
||||||
{% if debug %}
|
|
||||||
{{ minified_js('app_debug')|safe }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include "zerver/topic_is_muted.html" %}
|
{% include "zerver/topic_is_muted.html" %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -30,6 +30,13 @@ module.exports = {
|
||||||
test: /(min|zxcvbn)\.js/,
|
test: /(min|zxcvbn)\.js/,
|
||||||
use: [ 'script-loader' ],
|
use: [ 'script-loader' ],
|
||||||
},
|
},
|
||||||
|
// Expose Global variables to webpack
|
||||||
|
{
|
||||||
|
test: require.resolve('../static/js/debug.js'),
|
||||||
|
use: [
|
||||||
|
{loader: 'expose-loader', options: 'debug'},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,11 @@ var BundleTracker = require('webpack-bundle-tracker');
|
||||||
|
|
||||||
// katex should be an array, to inject webpack dependencies in dev config
|
// katex should be an array, to inject webpack dependencies in dev config
|
||||||
// better to be moved to common.js when common.js is added to assets
|
// better to be moved to common.js when common.js is added to assets
|
||||||
|
// Built webpack dev asset reloader
|
||||||
config.entry.katex.unshift('webpack-dev-server/client?/sockjs-node');
|
config.entry.katex.unshift('webpack-dev-server/client?/sockjs-node');
|
||||||
|
// Out JS debugging tools
|
||||||
|
config.entry.katex.push('./static/js/debug.js');
|
||||||
|
|
||||||
config.devtool = 'eval';
|
config.devtool = 'eval';
|
||||||
config.output.publicPath = '/webpack/';
|
config.output.publicPath = '/webpack/';
|
||||||
config.plugins.push(new BundleTracker({filename: 'static/webpack-bundles/webpack-stats-dev.json'}));
|
config.plugins.push(new BundleTracker({filename: 'static/webpack-bundles/webpack-stats-dev.json'}));
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
ZULIP_VERSION = "1.6.0+git"
|
ZULIP_VERSION = "1.6.0+git"
|
||||||
PROVISION_VERSION = '5.6'
|
PROVISION_VERSION = '5.7'
|
||||||
|
|
|
@ -828,10 +828,6 @@ JS_SPECS = {
|
||||||
],
|
],
|
||||||
'output_filename': 'min/signup.js'
|
'output_filename': 'min/signup.js'
|
||||||
},
|
},
|
||||||
'app_debug': {
|
|
||||||
'source_filenames': ['js/debug.js'],
|
|
||||||
'output_filename': 'min/app_debug.js'
|
|
||||||
},
|
|
||||||
'app': {
|
'app': {
|
||||||
'source_filenames': [
|
'source_filenames': [
|
||||||
'third/bootstrap-notify/js/bootstrap-notify.js',
|
'third/bootstrap-notify/js/bootstrap-notify.js',
|
||||||
|
|
Loading…
Reference in New Issue