1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-05-06 10:35:30 +02:00

fix worker paths

This commit is contained in:
Kushagra Gour 2018-10-25 19:17:51 +05:30
parent f49c9a1f68
commit dce9de0731
2 changed files with 4 additions and 4 deletions

View File

@ -1,13 +1,13 @@
importScripts('/lib/prettier/standalone.js');
importScripts('./prettier/standalone.js');
function prettify({ content, type }) {
let plugins, parser;
if (type === 'js') {
parser = 'babylon';
importScripts('/lib/prettier/parser-babylon.js');
importScripts('./prettier/parser-babylon.js');
} else if (type === 'css') {
parser = 'css';
importScripts('/lib/prettier/parser-postcss.js');
importScripts('./prettier/parser-postcss.js');
}
if (!parser) {

View File

@ -462,7 +462,7 @@ export function getFilenameFromUrl(url) {
export function prettify(content, type = 'js') {
const d = deferred();
const worker = new Worker('/lib/prettier-worker.js');
const worker = new Worker(`${BASE_PATH}/lib/prettier-worker.js`);
worker.postMessage({ content, type });
worker.addEventListener('message', e => {
d.resolve(e.data);