Giter VIP home page Giter VIP logo

esm-extension's Introduction

preact-es2020-template

A skeleton for un-bundled preact projects.

Install

this command will do an npm install for you

npm run vendor

Build

npm run build

Watch

# Removed/broken until https://github.com/cevek/ttypescript/issues/121 is fixed
# npx --no-install ttsc --watch

Serve

npm run serve

No bundler, pure ES2020 modules loaded directly into the browser. It uses es-module-shims for import map polyfill in browsers without native support but otherwise doesn't use any special loaders, bundlers, file servers, etc. Hosting is done via a static file server, you could use any static file server you wanted but I chose http-server because it is small and simple.

The one caveat with this project is the vendoring of dependencies. To add a runtime dependency:

  1. open build/vendor.ts
  2. create an entry in the array at the top
  3. specify the dependency package name (the thing you would put in the TS import statement)
  4. specify the path within the package that should be copied (the whole folder will be vendored recursively, usually this is a dist or out folder)
  5. the path (relative to the copied folder from previous step) to the index file for the package (usually index.js or package-name.js or package-name.min.js)
  6. from the root directory of this project run npm run vendor

This will generate the runtime import map and embed it into your index.html file so the browser can turn import { ... } from 'my-package' into a fetch of ./vendor/my-package/dist/index-file.js.

esm-extension's People

Contributors

micahzoltu avatar

Stargazers

 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.