Skip to content

global is not defined #11

@rioukevin

Description

@rioukevin

Hello,

I use vuepress (Vuejs) that use library using has-symbols, an error occured:
global is not defined in the library script

'use strict';

// V Error is throw next line V
var origSymbol = global.Symbol;
var hasSymbolSham = require('./shams');

module.exports = function hasNativeSymbols() {
	if (typeof origSymbol !== 'function') { return false; }
	if (typeof Symbol !== 'function') { return false; }
	if (typeof origSymbol('foo') !== 'symbol') { return false; }
	if (typeof Symbol('bar') !== 'symbol') { return false; }

	return hasSymbolSham();
};

So to correct it, I add in my scripts

window.global = window

I see that this error is throwed with angular also, so it looks that more and more framework doesn't support global 😉

Can you add a check on window.global to avoid create an error when it isn't define ?
Just emit a default value when not defined ?

Thank you 😃 😄

Have a nice day and be happy !
Kévin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions