From b9242c2d9e11ccaacf54e0369f4c23ca68656cf4 Mon Sep 17 00:00:00 2001 From: Robert Long <robert@robertlong.me> Date: Tue, 13 Mar 2018 17:12:39 -0700 Subject: [PATCH] Fix smoke tests. --- webpack.config.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 476914544..9fa17dd4b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -73,7 +73,7 @@ class LodashTemplatePlugin { } } -module.exports = { +const config = { entry: { lobby: path.join(__dirname, "src", "lobby.js"), room: path.join(__dirname, "src", "room.js"), @@ -201,3 +201,30 @@ module.exports = { }) ] }; + +module.exports = () => { + if (process.env.GENERATE_SMOKE_TESTS && process.env.BASE_ASSETS_PATH) { + const smokeConfig = Object.assign({}, config, { + // Set the public path for to point to the correct assets on the smoke-test build. + output: Object.assign({}, config.output, { + publicPath: process.env.BASE_ASSETS_PATH.replace("://", "://smoke-") + }), + // For this config + plugins: config.plugins.map(plugin => { + if (plugin instanceof HTMLWebpackPlugin) { + return new HTMLWebpackPlugin( + Object.assign({}, plugin.options, { + filename: "smoke-" + plugin.options.filename + }) + ); + } + + return plugin; + }) + }); + + return [config, smokeConfig]; + } else { + return config; + } +}; -- GitLab