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:
parent
f49c9a1f68
commit
dce9de0731
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user