Server render the main page
Also, add hashes to asset file names and use the "entry manifest" plugin in dev to get auto-reloading.
This commit is contained in:
32
public/systemjs@2.0.0/dist/extras/transform.js
vendored
Normal file
32
public/systemjs@2.0.0/dist/extras/transform.js
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Support for a "transform" loader interface
|
||||
*/
|
||||
(function () {
|
||||
const systemJSPrototype = System.constructor.prototype;
|
||||
|
||||
const instantiate = systemJSPrototype.instantiate;
|
||||
systemJSPrototype.instantiate = function (url, parent) {
|
||||
if (url.slice(-5) === '.wasm')
|
||||
return instantiate.call(this, url, parent);
|
||||
|
||||
const loader = this;
|
||||
return fetch(url)
|
||||
.then(function (res) {
|
||||
if (!res.ok)
|
||||
throw new Error('Fetch error: ' + res.status + ' ' + res.statusText + (parent ? ' loading from ' + parent : ''));
|
||||
return res.text();
|
||||
})
|
||||
.then(function (source) {
|
||||
return loader.transform.call(this, url, source);
|
||||
})
|
||||
.then(function (source) {
|
||||
(0, eval)(source + '\n//# sourceURL=' + url);
|
||||
return loader.getRegister();
|
||||
});
|
||||
};
|
||||
|
||||
// Hookable transform function!
|
||||
systemJSPrototype.transform = function (_id, source) {
|
||||
return source;
|
||||
};
|
||||
})();
|
Reference in New Issue
Block a user