mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-12 17:46:26 +02:00
fix worker paths
This commit is contained in:
@ -1,13 +1,13 @@
|
|||||||
importScripts('/lib/prettier/standalone.js');
|
importScripts('./prettier/standalone.js');
|
||||||
|
|
||||||
function prettify({ content, type }) {
|
function prettify({ content, type }) {
|
||||||
let plugins, parser;
|
let plugins, parser;
|
||||||
if (type === 'js') {
|
if (type === 'js') {
|
||||||
parser = 'babylon';
|
parser = 'babylon';
|
||||||
importScripts('/lib/prettier/parser-babylon.js');
|
importScripts('./prettier/parser-babylon.js');
|
||||||
} else if (type === 'css') {
|
} else if (type === 'css') {
|
||||||
parser = 'css';
|
parser = 'css';
|
||||||
importScripts('/lib/prettier/parser-postcss.js');
|
importScripts('./prettier/parser-postcss.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parser) {
|
if (!parser) {
|
||||||
|
@ -462,7 +462,7 @@ export function getFilenameFromUrl(url) {
|
|||||||
|
|
||||||
export function prettify(content, type = 'js') {
|
export function prettify(content, type = 'js') {
|
||||||
const d = deferred();
|
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.postMessage({ content, type });
|
||||||
worker.addEventListener('message', e => {
|
worker.addEventListener('message', e => {
|
||||||
d.resolve(e.data);
|
d.resolve(e.data);
|
||||||
|
Reference in New Issue
Block a user