Git Product home page Git Product logo

umdtutorial's Introduction

This repository serves as documentation and testing for UMD.

Imports

Module

  • Will not work as file:// because browser throws an error. Works http:// and https://
  • Will work with window., but this is bad practice when the file is anticipated to be a module.
  • Namespace imports are ignored (i.e., import * as UMD from './umd.js', UMD is ignored.
    • We believe this is because it is directly exported by the module to globals, so there is no export to import by the importing module.
  • Modules must use the export that's in the UMD section.
    • From the exporting file: factory(global.ExampleUMD = {}) but be referred to as ExampleUMD

Non-Module

  • Will work when being server over file://, http:// and https://.
  • Must use window.ExampleUMD and cannot use the export directly, i.e.ExampleUMD.
  • Cannot use import in any Javascript.
  • In the UMD export, the global. becomes window. for the browser.
    • This is why the UMD library doesn't ever refer to window.

Var Encapsulate

  • UMD declaration must be at the end of the file. This is unlike the unencapsulated version which allows the declaration and exports at the beginning of the file.

Resources

Useful examples and documentation on UMD:

Blogs: https://jameshfisher.com/2020/10/04/what-are-umd-modules/ https://jakearchibald.com/2017/es-modules-in-browsers/ https://salomvary.com/es6-modules-in-browsers.html

Issues: systemjs/systemjs#2064 systemjs/systemjs#1933

paroi-tech/direct-vuex#14

Repos: https://github.com/umdjs/umd/

Other: https://stackoverflow.com/a/63751410/15147681 https://github.com/paulmillr/noble-secp256k1/releases/tag/1.6.3 evanw/esbuild#507 (comment)

umdtutorial's People

Contributors

zamicol avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.