Closed
Description
Description/Screenshot
We maintain a Docusaurus app insights plugin (within the MSFT org). As part of adding the ClickAnalyticsPlugin
, we encountered an issue where code that is intended for the browser is being evaluated at build time on the node side.
It turns out that the hasDocument
function is being imported and used, but not invoked as a function.
https://github.com/search?q=repo%3Amicrosoft%2FApplicationInsights-JS%20hasDocument&type=code
All callsites should be updated to correctly invoke hasDocument
as a function.
Steps to Reproduce
- OS/Browser: macosx/Chrome
- SDK Version [e.g. 22]: Not sure? This is an issue in the latest published npm package
- How you initialized the SDK: yarn install
Steps
- clone the Docusaurus Plugins repo:
git clone https://github.com/microsoft/docusaurus-plugins
- checkout the branch that exhibits this issue:
git checkout click-analytics-to-client
- install deps:
yarn install
- run a build:
yarn build
Expected behavior
hasDocument
should be invoked as a function to correctly evaluate whether we're in a browser environment.
Additional context
N/A