henk-badenhorst / vue-hotjar-next Goto Github PK
View Code? Open in Web Editor NEWA NPM package to easily integrate Hotjar to any Vue 3 Project
Home Page: https://www.npmjs.com/package/vue-hotjar-next
License: MIT License
A NPM package to easily integrate Hotjar to any Vue 3 Project
Home Page: https://www.npmjs.com/package/vue-hotjar-next
License: MIT License
Sorry to bother again. The issue is related again with #8 . After the fix the error went away but the code is trying to load Hotjar code that relies on window
therefore when building it on Node for prerrendering the new issue arises.
The fix is as simple as https://github.com/tailwindlabs/headlessui/pull/867/files As you did a PR yourself leaving mine I just comment what you should change.
Add if (typeof window === 'undefined') return
previous to line
Line 13 in 95f4df0
I'm building a Vue3 + vite project and I'm using vite-ssg. When I build the website I get the following error.
ReferenceError: self is not defined
at Object.<anonymous> (/Volumes/Data/Development/skedr/next_landing/node_modules/vue-hotjar-next/index.js:1:224)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Module.<anonymous> (/Volumes/Data/Development/skedr/next_landing/.vite-ssg-temp/main.js:11:17)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
error Command failed with exit code 1.
From what I've read the issue is in the configuration of the webpack.js
files https://webpack.js.org/configuration/output/#outputglobalobject
Adding
module.exports = {
// ...
output: {
globalObject: 'this',
},
};
Instead of the default self
should make it work. I can do the PR but I'm not sure how that should be tested.
I am run normally in vite development mode successful. But can't built.
vite v2.3.8 building for production...
โ 645 modules transformed.
'default' is not exported by node_modules/vue-hotjar-next/index.js, imported by src/main.js
file: <PROJECT_ROOT>/src/main.js:3:7
1: import { createApp } from 'vue'
2: import { createGtm } from '@gtm-support/vue-gtm'
3: import Hotjar from 'vue-hotjar-next'
^
4: import firebase from 'firebase/app'
5: import 'firebase/firestore'
error during build:
Error: 'default' is not exported by node_modules/vue-hotjar-next/index.js, imported by src/main.js
at error (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:164:30)
at Module.error (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:9883:16)
at Module.traceVariable (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:10264:29)
at ModuleScope.findVariable (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:9041:39)
at Identifier.bind (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:4572:40)
at CallExpression.bind (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:2891:31)
at CallExpression.bind (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:6989:15)
at ExpressionStatement.bind (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:2895:23)
at Program.bind (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:2891:31)
at Module.bindReferences (<PROJECT_ROOT>/node_modules/rollup/dist/shared/rollup.js:9879:18)
In the original vue 2 implementation there was a way to track changes manually.
if (this.$hj) {
this.$hj('stateChange', '/your/url/here')
}
Is this no longer available in this package? If it is but missing it, how might we go about doing that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.