davideicardi / live-plugin-manager

Plugin manager and installer for Node.JS
MIT License
225 stars 43 forks source link

0.13.2 - global.Date is undefined #17

Closed jamesgibson14 closed 4 years ago

jamesgibson14 commented 4 years ago

I ran into a package that tries to use the global Date function and fails because it is undefined in the context Package is "tedious" a dependency of "mssql", from it's code:

const globalDate = global.Date;
const YEAR_ONE = new globalDate(2000, 0, -730118);

The second line fails with TypeError: globalDate is not a constructor I can debug and there are plenty of global variables but not Date

jamesgibson14 commented 4 years ago

I can debug it to these lines in createGlobalSandbox:

const sandbox = {
            ...srcGlobal,
            process: Object.create(srcGlobal.process)
        };

before srcGlobal has the .Date after the spread sandbox does not have the .Date

jamesgibson14 commented 4 years ago

Okay so I was looking at 0.14.0 and is looks like you have fixed this. Can you publish to Npm?

davideicardi commented 4 years ago

Yes, that is a strange problem. I have also published a question on SO: https://stackoverflow.com/questions/59009214/some-properties-of-the-global-instance-are-not-copied-by-spread-operator-or-by-o

Just published v0.14.

thanks!