Instead of loading script directly use requirejs config so it can be lazy loaded

This commit is contained in:
Alasdair Smith 2018-03-23 13:52:48 +00:00
parent e9de83789a
commit 5e2f838af4
2 changed files with 3 additions and 2 deletions

View file

@ -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)

View file

@ -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,