fix(client): use babel polyfill for async
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
/* 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);
|
||||
self.console.log = function proxyConsole(...args) {
|
||||
|
@ -63,8 +63,8 @@ export const cssToHtml = cond([
|
||||
// ) => Observable[{ build: String, sources: Dictionary }]
|
||||
export function concatHtml(required, template, files) {
|
||||
const createBody = template ? _template(template) : defaultTemplate;
|
||||
const sourceMap = Promise.all(files).then(
|
||||
files => files.reduce((sources, file) => {
|
||||
const sourceMap = Promise.all(files).then(files =>
|
||||
files.reduce((sources, file) => {
|
||||
sources[file.name] = file.source || file.contents;
|
||||
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 }))
|
||||
);
|
||||
|
||||
/* 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 =
|
||||
'<script src="/js/frame-runner.js" type="text/javascript"></script>';
|
||||
|
||||
return from(
|
||||
Promise.all([head, body, frameRunner, sourceMap]).then(
|
||||
([head, body, frameRunner, sourceMap]) => ({
|
||||
build: head + body + frameRunner,
|
||||
Promise.all([head, body, babelPolyfill, frameRunner, sourceMap]).then(
|
||||
([head, body, babelPolyfill, frameRunner, sourceMap]) => ({
|
||||
build: head + body + babelPolyfill + frameRunner,
|
||||
sources: sourceMap
|
||||
})
|
||||
)
|
||||
|
@ -15,7 +15,7 @@ import { isPromise } from './polyvinyl';
|
||||
|
||||
const jQueryCDN =
|
||||
'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 =
|
||||
"<script src='/js/frame-runner.js' type='text/javascript'></script>";
|
||||
|
||||
|
Reference in New Issue
Block a user