mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-17 20:11:12 +02:00
extension: fix path for worker
This commit is contained in:
@@ -165,7 +165,7 @@ gulp.task('generate-service-worker', function(callback) {
|
||||
});
|
||||
|
||||
gulp.task('packageExtension', function() {
|
||||
child_process.execSync('cp -R app extension/');
|
||||
child_process.execSync('cp -R app extension');
|
||||
child_process.execSync('cp src/manifest.json extension');
|
||||
child_process.execSync('cp src/options.js extension');
|
||||
child_process.execSync('cp src/options.html extension');
|
||||
|
@@ -462,7 +462,11 @@ export function getFilenameFromUrl(url) {
|
||||
|
||||
export function prettify(content, type = 'js') {
|
||||
const d = deferred();
|
||||
const worker = new Worker(`${BASE_PATH}/lib/prettier-worker.js`);
|
||||
const worker = new Worker(
|
||||
chrome.extension
|
||||
? chrome.extension.getURL('lib/prettier-worker.js')
|
||||
: `${BASE_PATH}/lib/prettier-worker.js`
|
||||
);
|
||||
worker.postMessage({ content, type });
|
||||
worker.addEventListener('message', e => {
|
||||
d.resolve(e.data);
|
||||
|
Reference in New Issue
Block a user