Coder Social home page Coder Social logo

global's Introduction

global

Require global variables

Example

var global = require("global")
var document = require("global/document")
var window = require("global/window")

Installation

npm install global

Contributors

  • Raynos

MIT Licenced

global's People

Contributors

iwillig avatar jaimeagudo avatar kristoferjoseph avatar matt-esch avatar pauan avatar pdehaan avatar raynos avatar shinnn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

global's Issues

Can't resolve 'global/window' (webpack)

ERROR in ./node_modules/my-module/index.js 2:28-34
Module not found: Error: Can't resolve 'global/window' in './node_modules/my-module'
Did you mean 'window.js'?
BREAKING CHANGE: The request 'global/window' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

This appears to be because global/window is not a valid identifier in ES modules so every single example on the web fails:

    new webpack.ProvidePlugin({
      window: "global/window",
      document: "global/document",
    }),

Thankfully in this case the solution was:

    new webpack.ProvidePlugin({
      window: "global/window.js",
      document: "global/document.js",
    }),

This might be fixable with export maps in package.json, but I'm not entirely sure.

What does this module do?

Forgive me for a potentially elementary question, but I saw this module in use in the wild and couldn't figure out what it was for other than to satisfy linting errors. Coming upon the README didn't offer much more on the subject, so I thought I'd ask. And suggest perhaps putting the "why" in the README?

'default' is not exported by 'node_modules/global/document.js'

Seeing this error when using rollup as a bundler. Any ideas what this could be?

~/c/videomail-client ❯❯❯ yarn test
yarn test v0.24.5
$ rollup -c etc/rollup/test.js && cat test/dist/index.js | tape-run 
100% (80): src/wrappers/visuals/replay.js⚠️   'default' is not exported by 'node_modules/global/document.js'
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
commonjs-proxy:/home/michael-heuberger/code/videomail-client/node_modules/global/document.js (1:145)
1: import * as document from "/home/michael-heuberger/code/videomail-client/node_modules/global/document.js"; export default ( document && document['default'] ) || document;

Ok, I can't be the first to say this...

I ran: 'yarn add [the module I wanted to add globally] global' about 20 times before I realized that it was adding my module (locally) and this module. :/

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.