Giter VIP home page Giter VIP logo

vue-hotjar-next's People

Contributors

ebisbe avatar henk-badenhorst avatar henk-badenhorst-rabo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gerput ebisbe

vue-hotjar-next's Issues

Vite-ssg prerender ReferenceError: window is not defined

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

new Hotjar(id, snippetVersion, isProduction);

Building project with vite-ssg errors with: ReferenceError: self is not defined

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.

Cannot built by vite

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)

Track Changes Manually

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.