diff --git a/webpack.config.js b/webpack.config.js index 47691454412d6ed538d46f2c2091126190e3db38..9fa17dd4bd2e5510e2ec8545fda2a9a244ce9f09 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; + } +};