Explorar o código

Instead of using webpack chunk hashing, use existing system

Alasdair Smith %!s(int64=8) %!d(string=hai) anos
pai
achega
408c195c6a

+ 8 - 0
services/web/app/coffee/infrastructure/ExpressLocals.coffee

@@ -41,6 +41,7 @@ pathList = [
 	"#{jsPath}ide.js"
 	"#{jsPath}main.js"
 	"#{jsPath}libraries.js"
+	"#{jsPath}es/richText.js"
 	"/stylesheets/style.css"
 	"/stylesheets/ol-style.css"
 ]
@@ -146,6 +147,13 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
 				path = path + "?" + qs
 			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)->
 			path = Path.join("/stylesheets/", cssFile)
 			if opts?.hashedPath && hashedFiles[path]?

+ 1 - 2
services/web/app/views/project/editor.pug

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

+ 0 - 7
services/web/webpack.config.prod.js

@@ -7,13 +7,6 @@ module.exports = merge(base, {
   // Enable a full 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: [
     // Use UglifyJS to minimise output
     new webpack.optimize.UglifyJsPlugin({