Closed joeldenning closed 7 years ago
Neither webpack nor jspm support module.parent, which causes problems when bundling uniqid. In the case of jspm, even when uniqid is just a build tool (that's helping bundle other things but is not even being bundled itself), it will throw errors since jspm/systemjs build tools run inside of a controlled non-cjs environment. See https://github.com/webpack/webpack/issues/1569, https://github.com/jspm/jspm-cli/issues/2134, and https://github.com/systemjs/systemjs/issues/1470.
module.parent
This change simply is to be defensive so that uniqid doesn't die when it is running in the browser or an environment that doesn't have full cjs support (like webpack and jspm)
Neither webpack nor jspm support
module.parent
, which causes problems when bundling uniqid. In the case of jspm, even when uniqid is just a build tool (that's helping bundle other things but is not even being bundled itself), it will throw errors since jspm/systemjs build tools run inside of a controlled non-cjs environment. See https://github.com/webpack/webpack/issues/1569, https://github.com/jspm/jspm-cli/issues/2134, and https://github.com/systemjs/systemjs/issues/1470.This change simply is to be defensive so that uniqid doesn't die when it is running in the browser or an environment that doesn't have full cjs support (like webpack and jspm)