diff --git a/static/index-web.html b/static/index-web.html index f97bade35..b9ffe6fd2 100644 --- a/static/index-web.html +++ b/static/index-web.html @@ -3,7 +3,6 @@ - diff --git a/web/bundle-id.js b/web/bundle-id.js new file mode 100644 index 000000000..80530a28d --- /dev/null +++ b/web/bundle-id.js @@ -0,0 +1,8 @@ +const uuid = require('uuid/v4'); +const jsBundleId = uuid(); + +function getJsBundleId() { + return jsBundleId; +} + +module.exports = { getJsBundleId }; diff --git a/web/package.json b/web/package.json index 69547e350..a8c6983ab 100644 --- a/web/package.json +++ b/web/package.json @@ -34,7 +34,8 @@ "lbry-redux": "lbryio/lbry-redux#c107d9cc4c4b2cc31f182f196ab6a033aefe976e", "lbryinc": "lbryio/lbryinc#6a52f8026cdc7cd56d200fb5c46f852e0139bbeb", "mysql": "^2.17.1", - "node-fetch": "^2.6.0" + "node-fetch": "^2.6.0", + "uuid": "^8.3.0" }, "devDependencies": { "@babel/core": "^7.0.0", diff --git a/web/src/html.js b/web/src/html.js index 3532d6e83..ee38225cf 100644 --- a/web/src/html.js +++ b/web/src/html.js @@ -14,11 +14,16 @@ const { getClaim } = require('./chainquery'); const { parseURI } = require('lbry-redux'); const fs = require('fs'); const path = require('path'); +const { getJsBundleId } = require('../bundle-id.js'); +const jsBundleId = getJsBundleId(); function insertToHead(fullHtml, htmlToInsert) { return fullHtml.replace( /.*/s, - htmlToInsert || buildOgMetadata() + ` + ${htmlToInsert || buildOgMetadata()} + + ` ); } diff --git a/web/webpack.config.js b/web/webpack.config.js index c89753fb2..197bfeea5 100644 --- a/web/webpack.config.js +++ b/web/webpack.config.js @@ -6,6 +6,7 @@ const baseConfig = require('../webpack.base.config.js'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const { DefinePlugin, ProvidePlugin } = require('webpack'); const SentryWebpackPlugin = require('@sentry/webpack-plugin'); +const { getJsBundleId } = require('./bundle-id.js'); const { insertToHead, buildBasicOgMetadata } = require('./src/html'); const { insertVariableXml, getOpenSearchXml } = require('./src/xml'); @@ -16,6 +17,7 @@ const DIST_ROOT = path.resolve(__dirname, 'dist/'); const WEB_PLATFORM_ROOT = __dirname; const isProduction = process.env.NODE_ENV === 'production'; const hasSentryToken = process.env.SENTRY_AUTH_TOKEN !== undefined; +const jsBundleId = getJsBundleId(); const copyWebpackCommands = [ { @@ -80,7 +82,7 @@ if (isProduction && hasSentryToken) { const webConfig = { target: 'web', entry: { - ui: '../ui/index.jsx', + [`ui-${jsBundleId}`]: '../ui/index.jsx', }, output: { filename: '[name].js', diff --git a/web/yarn.lock b/web/yarn.lock index b43340d3b..66d0cf9a0 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -5413,6 +5413,11 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== +uuid@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea" + integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ== + vary@^1.1.2, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"