fix(client): use babel polyfill for async
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
/* global chai, importScripts */
|
/* global chai, importScripts */
|
||||||
importScripts('https://cdnjs.cloudflare.com/ajax/libs/chai/4.2.0/chai.min.js');
|
importScripts(
|
||||||
|
'https://cdnjs.cloudflare.com/ajax/libs/chai/4.2.0/chai.min.js',
|
||||||
|
'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill.min.js'
|
||||||
|
);
|
||||||
|
|
||||||
const oldLog = self.console.log.bind(self.console);
|
const oldLog = self.console.log.bind(self.console);
|
||||||
self.console.log = function proxyConsole(...args) {
|
self.console.log = function proxyConsole(...args) {
|
||||||
|
@ -63,8 +63,8 @@ export const cssToHtml = cond([
|
|||||||
// ) => Observable[{ build: String, sources: Dictionary }]
|
// ) => Observable[{ build: String, sources: Dictionary }]
|
||||||
export function concatHtml(required, template, files) {
|
export function concatHtml(required, template, files) {
|
||||||
const createBody = template ? _template(template) : defaultTemplate;
|
const createBody = template ? _template(template) : defaultTemplate;
|
||||||
const sourceMap = Promise.all(files).then(
|
const sourceMap = Promise.all(files).then(files =>
|
||||||
files => files.reduce((sources, file) => {
|
files.reduce((sources, file) => {
|
||||||
sources[file.name] = file.source || file.contents;
|
sources[file.name] = file.source || file.contents;
|
||||||
return sources;
|
return sources;
|
||||||
}, {})
|
}, {})
|
||||||
@ -101,13 +101,18 @@ A required file can not have both a src and a link: src = ${src}, link = ${link}
|
|||||||
.map(source => createBody({ source }))
|
.map(source => createBody({ source }))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
const babelPolyfillCDN =
|
||||||
|
'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill.min.js';
|
||||||
|
const babelPolyfill = `<script src="${babelPolyfillCDN}" type="text/javascript"></script>`;
|
||||||
|
/* eslint-enable max-len */
|
||||||
const frameRunner =
|
const frameRunner =
|
||||||
'<script src="/js/frame-runner.js" type="text/javascript"></script>';
|
'<script src="/js/frame-runner.js" type="text/javascript"></script>';
|
||||||
|
|
||||||
return from(
|
return from(
|
||||||
Promise.all([head, body, frameRunner, sourceMap]).then(
|
Promise.all([head, body, babelPolyfill, frameRunner, sourceMap]).then(
|
||||||
([head, body, frameRunner, sourceMap]) => ({
|
([head, body, babelPolyfill, frameRunner, sourceMap]) => ({
|
||||||
build: head + body + frameRunner,
|
build: head + body + babelPolyfill + frameRunner,
|
||||||
sources: sourceMap
|
sources: sourceMap
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -15,7 +15,7 @@ import { isPromise } from './polyvinyl';
|
|||||||
|
|
||||||
const jQueryCDN =
|
const jQueryCDN =
|
||||||
'https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js';
|
'https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js';
|
||||||
const jQuery = `<script src='${jQueryCDN}' typ='text/javascript'></script>`;
|
const jQuery = `<script src='${jQueryCDN}' type='text/javascript'></script>`;
|
||||||
const frameRunner =
|
const frameRunner =
|
||||||
"<script src='/js/frame-runner.js' type='text/javascript'></script>";
|
"<script src='/js/frame-runner.js' type='text/javascript'></script>";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user