ashleyscirra / import-as-and-html-modules Goto Github PK
View Code? Open in Web Editor NEWimportAs() and HTML modules proof-of-concept
importAs() and HTML modules proof-of-concept
Related to #4
The example from the README uses globals like JSON
which are expected to be already available when the module is instantiated. I don't know if that's the case, but even if it was: what about expressions in general?
Something like
const Something = ...;
import "xx" as Something;
would not work because Something
has not been initialized yet.
Possible alternatives:
import "xx" as "something";
// or
import Something from "something";
import "xx" as Something;
Will it be possible to pass additional arguments to the Symbol.importer
method? This could be necessary in order to support some Web Assembly use-cases (#3) where someone wants to pass an importObject
to the underlying WebAssembly.instantiate()
.
The tricky part here is to figure out in which phase of the module graph initialization Symbol.importer
would get executed.
Super initiative to refresh the whole HTML Imports!
However, to really copy the behavior of HTML Imports, the inline script tags should execute upon loading of the HTMLModule. This is not the case in this implementation or am i missing something?
I really like the approach taken here..
Hey @AshleyScirra , super cool concept. We're wondering if you plan on continuing with development, or what other solutions to this problem you've come across.
We've got a ton of polymer 3 elements we've created and it would be super cool if we could use something like this to code split out the individual parts. Since you've coded this I'm guessing you have thought about the problem quite a bit. Could we get some of your thoughts? Right now we bundle everything with webpack using static ES6 imports. My email is [email protected].
Hey @AshleyScirra ๐,
I really like your proposal. I think this would allow us to substitute webpack loaders in the long run.
Another use case I see (and I was surprised not to find in the README) is Web Assembly support:
import {myRustFunction} from "./my-rust-function.wasm" as WasmModule;
where WasmModule
would do the WebAssembly.instantiateStreaming()
dance.
Would do you think?
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.