marijnh / moduleserve Goto Github PK
View Code? Open in Web Editor NEWDevelopment shim for serving up CommonJS modules
License: MIT License
Development shim for serving up CommonJS modules
License: MIT License
I wanted to have access to modules directly, so I can access them in the browser JS console and play around.
I exposed var loaded
onto window.LoadedModules
, so I can access modules directly via their relative path.
e.g.
LoadedModules["/../dist/format/index"].parseFrom( LoadedModules["/../dist/model/defaultschema"].defaultSchema, "* test*", "markdown" )
I also ended up exposing the root module, so I can load other modules on the fly via mainModule.require( "/../dist/markdown" )
Not really suggesting any changes, just sharing what I'm doing.
npm install omit.js --save
and require("omit.js")
will fail loading. Presumably because the node module name ends in .js
The --spa
option is not very usable in that it will always respond the index html file for any type of requests e.g. js and css.
You can repro with my demo at https://github.com/Huxpro/githuber.re-v2 by:
npm install && npm run start
and in another tab: npm run dev
.See ProseMirror/prosemirror#143.
In order to get it working with prosemirror, I modified babel-transform.js:15 to be
return babel.transform(text, {presets:['es2015']}).code
I've modified the ProseMirror demo to require a module for an experiment.
The module has a dependency on a module in ProseMirror, so I import it accordingly. I run this through babel via ./node_modules/.bin/babel -d demo/dist demo/src
, which gets required by the demo's main script.
The name ../../dist/model
ends up being resolved to /dist/dist/model
, where I might expect it to resolve to /../dist/model
.
I tried debugging why this is happening inside the resolving code, but I'm not sure what would need to change to support this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.