bulma-calendar icon indicating copy to clipboard operation
bulma-calendar copied to clipboard

Navigator not defined when bundling with webpack

Open richardtks opened this issue 5 years ago • 6 comments

Your issue may already be reported! Please search on the issue track before creating one.

  • [X] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • [X] Are you running the latest version?
  • [X] Are you reporting to the correct repository?

Bug Report

Environment

  • Extension version(s): v6.0.7
  • Bulma version: v0.7.0
  • OS: macOS 10.14.5
  • Browser: all
  • How you are customizing the extension: no, just using the default one

Current Behavior Error prompt when building with webpack

//src/js/defaultOptions.js
lang: navigator.language.substring(0, 2) || 'en', // internationalization

Possible Solution Remove the navigator in the DefaultOptions or put the if statement to it when it is null.

Additional context/Screenshots Add any other context about the problem here. image

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codepen or similar. None

richardtks avatar Jun 03 '19 01:06 richardtks

@Wikiki .. having this same issue also.

using NuxtJS.

nizam27391 avatar Sep 04 '19 03:09 nizam27391

any updates?

JuAn-Kang avatar Mar 22 '20 20:03 JuAn-Kang

Same problem here with NextJS. I suppose this must fail with SSR-Frameworks since there is no navigator object on the server side. I would suggest to incorporate the bugfix of @richardtks to circumvent the issue.

hbel avatar Apr 02 '20 08:04 hbel

Same problem here with NextJS. I suppose this must fail with SSR-Frameworks since there is no navigator object on the server side. I would suggest to incorporate the bugfix of @richardtks to circumvent the issue.

Same situation here. If you have another pretty solution, I would appreciate it.

danielgamboar avatar Jul 02 '20 20:07 danielgamboar

Try:

export default {
  components: {
    bulmaCalendar: process.client ? import('bulma-calendar').bulmaCalendar : { }
  }
}

pperzyna avatar Jul 14 '20 13:07 pperzyna

For nextJS use dynamic imports and ssr:false.

const InvoiceForm = dynamic(
    () => import('../components/invoices/InvoiceForm'),
    { ssr: false }
);

mckennapaul27 avatar Jul 26 '22 14:07 mckennapaul27