From 5e2f838af4d7887df6e0e01d74be553a69aab9b8 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Fri, 23 Mar 2018 13:52:48 +0000 Subject: [PATCH] Instead of loading script directly use requirejs config so it can be lazy loaded --- services/web/app/coffee/infrastructure/ExpressLocals.coffee | 2 ++ services/web/app/views/project/editor.pug | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/infrastructure/ExpressLocals.coffee b/services/web/app/coffee/infrastructure/ExpressLocals.coffee index 490dd82348..9b36abe456 100644 --- a/services/web/app/coffee/infrastructure/ExpressLocals.coffee +++ b/services/web/app/coffee/infrastructure/ExpressLocals.coffee @@ -150,6 +150,8 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)-> res.locals.buildWebpackPath = (jsFile, opts = {}) -> if Settings.webpack? and !Settings.useMinifiedJs path = Path.join(jsPath, jsFile) + if opts.removeExtension == true + path = path.slice(0,-3) return "#{Settings.webpack.url}/public#{path}" else return res.locals.buildJsPath(jsFile, opts) diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index 33cfdfacfd..f4287334c8 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -133,6 +133,7 @@ block requirejs "fineuploader": "libs/#{lib('fineuploader')}", "ide": "#{buildJsPath('ide.js', {hashedPath:settings.useMinifiedJs, removeExtension:true})}", "libraries": "#{buildJsPath('libraries.js', {hashedPath:settings.useMinifiedJs, removeExtension:true})}", + !{moduleIncludes("editor:script", locals)} }, "waitSeconds": 0, "shim": { @@ -159,8 +160,6 @@ block requirejs window.pdfCMapsPath = "#{pdfCMapsPath}" window.uiConfig = JSON.parse('!{JSON.stringify(uiConfig).replace(/\//g, "\\/")}'); - != moduleIncludes("editor:script", locals) - script( data-main=buildJsPath("ide.js", {hashedPath:false}), baseurl=fullJsPath,