Instead of using webpack chunk hashing, use existing system

This commit is contained in:
Alasdair Smith 2018-03-13 15:43:35 +00:00
parent 8537c7b9b6
commit 408c195c6a
3 changed files with 9 additions and 9 deletions

View file

@ -41,6 +41,7 @@ pathList = [
"#{jsPath}ide.js" "#{jsPath}ide.js"
"#{jsPath}main.js" "#{jsPath}main.js"
"#{jsPath}libraries.js" "#{jsPath}libraries.js"
"#{jsPath}es/richText.js"
"/stylesheets/style.css" "/stylesheets/style.css"
"/stylesheets/ol-style.css" "/stylesheets/ol-style.css"
] ]
@ -146,6 +147,13 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
path = path + "?" + qs path = path + "?" + qs
return path return path
res.locals.buildWebpackPath = (jsFile, opts = {}) ->
if Settings.webpack? and !Settings.useMinifiedJs
path = Path.join(jsPath, jsFile)
return "#{Settings.webpack.host}:#{Settings.webpack.port}/public#{path}"
else
return res.locals.buildJsPath(jsFile)
res.locals.buildCssPath = (cssFile, opts)-> res.locals.buildCssPath = (cssFile, opts)->
path = Path.join("/stylesheets/", cssFile) path = Path.join("/stylesheets/", cssFile)
if opts?.hashedPath && hashedFiles[path]? if opts?.hashedPath && hashedFiles[path]?

View file

@ -159,10 +159,9 @@ block requirejs
window.pdfCMapsPath = "#{pdfCMapsPath}" window.pdfCMapsPath = "#{pdfCMapsPath}"
window.uiConfig = JSON.parse('!{JSON.stringify(uiConfig).replace(/\//g, "\\/")}'); window.uiConfig = JSON.parse('!{JSON.stringify(uiConfig).replace(/\//g, "\\/")}');
// TODO: inject based on environment
if hasFeature('rich-text') if hasFeature('rich-text')
script( script(
src="http://localhost:3809/public/js/es/richText.js" src=buildWebpackPath('es/richText.js', {hashedPath:settings.useMinifiedJs})
type="text/javascript" type="text/javascript"
) )

View file

@ -7,13 +7,6 @@ module.exports = merge(base, {
// Enable a full source map. // Enable a full source map.
devtool: 'source-map', devtool: 'source-map',
output: {
// Overwrite the default filename to include the chunkhash. This versions
// the output files so that they can be cached (and cache-busted when they
// change)
filename: '[name]-[chunkhash].js'
},
plugins: [ plugins: [
// Use UglifyJS to minimise output // Use UglifyJS to minimise output
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({