@@ -313,6 +313,13 @@ export function loadJS(src) {
313313 return d . promise ;
314314}
315315
316+ function getUrl ( relativeUrl ) {
317+ return chrome . extension
318+ ? chrome . extension . getURL ( relativeUrl )
319+ : `${
320+ location . origin
321+ } ${ BASE_PATH } /${ relativeUrl } `
322+ }
316323
317324/* eslint-disable max-params */
318325export function getCompleteHtml ( html , css , js , item , isForExport ) {
@@ -326,7 +333,7 @@ export function getCompleteHtml(html, css, js, item, isForExport) {
326333 . reduce ( function ( links , url ) {
327334 return (
328335 links +
329- ( url ? '\n<link rel="stylesheet" href="' + url + '"></link>' : '' )
336+ ( url ? '\n<link rel="stylesheet" href="' + getUrl ( url ) + '"></link>' : '' )
330337 ) ;
331338 } , '' ) ;
332339
@@ -355,20 +362,16 @@ export function getCompleteHtml(html, css, js, item, isForExport) {
355362 '"></script>' ;
356363 }
357364 contents +=
358- '<script src="' + Vue + '"></script>' ;
365+ '<script src="' + getUrl ( Vue ) + '"></script>' ;
359366 contents +=
360- '<script src="' + Vuex + '"></script>' ;
367+ '<script src="' + getUrl ( Vuex ) + '"></script>' ;
361368 contents +=
362- '<script src="' + vueSequence + '"></script>' ;
369+ '<script src="' + getUrl ( vueSequence ) + '"></script>' ;
363370
364371 if ( item . jsMode === JsModes . ES6 ) {
365372 contents +=
366373 '<script src="' +
367- ( chrome . extension
368- ? chrome . extension . getURL ( 'lib/transpilers/babel-polyfill.min.js' )
369- : `${
370- location . origin
371- } ${ BASE_PATH } /lib/transpilers/babel-polyfill.min.js`) +
374+ getUrl ( 'lib/transpilers/babel-polyfill.min.js' ) +
372375 '"></script>' ;
373376 }
374377
0 commit comments