improve bundle renderer file path detection

This commit is contained in:
Evan You 2017-02-25 09:41:56 -05:00
parent 3681016338
commit 1d22896587

View File

@ -37,7 +37,11 @@ export function createBundleRendererCreator (createRenderer: () => Renderer) {
let basedir = rendererOptions && rendererOptions.basedir
// load bundle if given filepath
if (typeof bundle === 'string' && bundle.charAt(0) === '/') {
if (
typeof bundle === 'string' &&
/\.js(on)?$/.test(bundle) &&
path.isAbsolute(bundle)
) {
if (fs.existsSync(bundle)) {
basedir = basedir || path.dirname(bundle)
bundle = fs.readFileSync(bundle, 'utf-8')