diff --git a/.gitignore b/.gitignore index 497b728ce49..e63d02fa5b4 100644 --- a/.gitignore +++ b/.gitignore @@ -60,4 +60,6 @@ upgrade/ hogvm/typescript/dist .wokeignore plugin-transpiler/dist -.dlt \ No newline at end of file +*-esbuild-meta.json +*-esbuild-bundle-visualization.html +.dlt diff --git a/frontend/__snapshots__/components-html-elements-display--editable-display--dark.png b/frontend/__snapshots__/components-html-elements-display--editable-display--dark.png index f4573ad7274..076a178e2f4 100644 Binary files a/frontend/__snapshots__/components-html-elements-display--editable-display--dark.png and b/frontend/__snapshots__/components-html-elements-display--editable-display--dark.png differ diff --git a/frontend/__snapshots__/components-html-elements-display--editable-display--light.png b/frontend/__snapshots__/components-html-elements-display--editable-display--light.png index b3f041fe952..9b81a5abac8 100644 Binary files a/frontend/__snapshots__/components-html-elements-display--editable-display--light.png and b/frontend/__snapshots__/components-html-elements-display--editable-display--light.png differ diff --git a/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--dark.png b/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--dark.png index 12b08518ad9..b228c0b33f2 100644 Binary files a/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--dark.png and b/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--dark.png differ diff --git a/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--light.png b/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--light.png index 3af5884481d..b0b714fb2b0 100644 Binary files a/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--light.png and b/frontend/__snapshots__/components-html-elements-display--editable-display-with-preselection--light.png differ diff --git a/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--dark.png b/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--dark.png index 6e0935a6dd3..be40d010138 100644 Binary files a/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--dark.png and b/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--dark.png differ diff --git a/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--light.png b/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--light.png index ef5c3a8ead8..0f88210edfa 100644 Binary files a/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--light.png and b/frontend/__snapshots__/components-html-elements-display--with-uniqueness-check--light.png differ diff --git a/frontend/build.mjs b/frontend/build.mjs index 4d616e8ea9e..febe4843ba7 100755 --- a/frontend/build.mjs +++ b/frontend/build.mjs @@ -51,9 +51,43 @@ await buildInParallel( // make sure we don't link to a global window.define banner: { js: 'var posthogToolbar = (function () { var define = undefined;' }, footer: { js: 'return posthogToolbar })();' }, - // This isn't great but we load some static assets at runtime for the toolbar and we can't sub in + // This isn't great, but we load some static assets at runtime for the toolbar, and we can't sub in // a variable at runtime it seems... publicPath: isDev ? '/static/' : 'https://app.posthog.com/static/', + alias: { + 'posthog-js': 'posthog-js-lite', + }, + writeMetaFile: true, + extraPlugins: [ + { + name: 'no-side-effects', + setup(build) { + // sideEffects in package.json lists files that _have_ side effects, + // but we only want to mark lemon-ui as having no side effects, + // so we'd have to list every other file and keep that up to date + // no thanks! + // a glob that negates the path doesn't seem to work + // so based off a comment from the esbuild author here + // https://github.com/evanw/esbuild/issues/1895#issuecomment-1003404929 + // we can add a plugin just for the toolbar build to mark lemon-ui as having no side effects + // that will allow tree-shaking and reduce the toolbar bundle size + // by over 40% at implementation time + build.onResolve({ filter: /^(lib|@posthog)\/lemon-ui/ }, async (args) => { + if (args.pluginData) { + return + } // Ignore this if we called ourselves + + const { path, ...rest } = args + rest.pluginData = true // Avoid infinite recursion + const result = await build.resolve(path, rest) + + result.sideEffects = false + + return result + }) + }, + }, + ], ...common, }, ], diff --git a/frontend/src/lib/components/Cards/TextCard/TextCardModal.tsx b/frontend/src/lib/components/Cards/TextCard/TextCardModal.tsx index c5e0f72a449..cbeab571702 100644 --- a/frontend/src/lib/components/Cards/TextCard/TextCardModal.tsx +++ b/frontend/src/lib/components/Cards/TextCard/TextCardModal.tsx @@ -4,7 +4,7 @@ import { textCardModalLogic } from 'lib/components/Cards/TextCard/textCardModalL import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini' import { LemonButton } from 'lib/lemon-ui/LemonButton' import { LemonModal } from 'lib/lemon-ui/LemonModal' -import { LemonTextAreaMarkdown } from 'lib/lemon-ui/LemonTextArea/LemonTextArea' +import { LemonTextAreaMarkdown } from 'lib/lemon-ui/LemonTextArea' import { userLogic } from 'scenes/userLogic' import { AvailableFeature, DashboardType } from '~/types' diff --git a/frontend/src/lib/components/HTMLElementsDisplay/HTMLElementsDisplay.tsx b/frontend/src/lib/components/HTMLElementsDisplay/HTMLElementsDisplay.tsx index c3a44586e77..9a02c7c5019 100644 --- a/frontend/src/lib/components/HTMLElementsDisplay/HTMLElementsDisplay.tsx +++ b/frontend/src/lib/components/HTMLElementsDisplay/HTMLElementsDisplay.tsx @@ -1,5 +1,4 @@ import { useActions, useValues } from 'kea' -import { CodeSnippet } from 'lib/components/CodeSnippet' import { htmlElementsDisplayLogic } from 'lib/components/HTMLElementsDisplay/htmlElementsDisplayLogic' import { ParsedCSSSelector } from 'lib/components/HTMLElementsDisplay/preselectWithCSS' import { LemonBanner } from 'lib/lemon-ui/LemonBanner' @@ -130,8 +129,11 @@ export function HTMLElementsDisplay({ return (
{chosenSelector}+