Giter VIP home page Giter VIP logo

Comments (3)

haoAddsearch avatar haoAddsearch commented on May 30, 2024

@oskari
null check was added in the latest release
https://github.com/AddSearch/js-client-library/releases/tag/v0.8.6
Could you check again please?

from js-client-library.

oskari avatar oskari commented on May 30, 2024

I'm sorry, my initial description was written a bit too hastily. Null check isn't sufficient as the whole document object is not available.

ERROR  UNKNOWN

There was an error compiling the html.js component for the development server.
See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html ReferenceError: document is not defined


  10 |
  11 | const getCookie = function(cookieName) {
> 12 |   if (!document) {
     | ^
  13 |     return;
  14 |   }
  15 |   let name = cookieName + "=";


  WebpackError: ReferenceError: document is not defined

  - cookie.js:12
    [www.mehilainen.fi]/[addsearch-js-client]/src/cookie.js:12:1

  - index.js:20
    [www.mehilainen.fi]/[addsearch-js-client]/src/index.js:20:1

I'd guess a better way around it would be typeof check, as seems to be the case in multiple js cookie libraries:

if (typeof document === 'undefined') {
    return
  }

https://github.com/js-cookie/js-cookie/blob/a427812597527fd82f9747fe075c2f65b93c3112/src/api.mjs#L6

from js-client-library.

haoAddsearch avatar haoAddsearch commented on May 30, 2024

Thank you for the PR @oskari
I published a new fixed version 0.8.7

from js-client-library.

Related Issues (5)

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.