Skip to content

Commit fa8c318

Browse files
author
Night Knight
committed
handle json parsing exceptions
1 parent ed67018 commit fa8c318

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ export default class WXAppPlugin {
152152

153153
async getComponents(components, instance) {
154154
const { usingComponents = {} } =
155-
await readJson(`${instance}.json`).catch(::console.error);
155+
await readJson(`${instance}.json`).catch(
156+
err => err && err.code !== 'ENOENT' && console.error(err)
157+
) || {};
156158
const componentBase = parse(instance).dir;
157159
for (const relativeComponent of values(usingComponents)) {
158160
const component = resolve(componentBase, relativeComponent);

0 commit comments

Comments
 (0)