facebook/flow

Cannot resolve JSON file starting with a dot

开放

#7,673 创建于 2019年4月26日

 (13 条评论) (0 个反应) (0 位负责人)Rust (1,885 个派生)batch import
Has PRbuggood first issuemodule resolution

仓库指标

星标
 (22,203 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Flow version:

version 0.97.0

Flow cannot resolve require with JSON filename starting with a dot:

const meta = require('../.meta.json');

It results in this error:

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ src/apps/graphql-skymock/datasets/__tests__/MetafileConsistency.test.js:7:22

Cannot resolve module ../.meta.json.

      4│ import path from 'path';
      5│ import Ajv from 'ajv';
      6│
      7│ const meta = require('../.meta.json');
      8│
      9│ test('every dataset defined in metafile should exist', () => {
     10│   expect.hasAssertions();

However, when I remove the dot (and rename the file) everything is fine:

const meta = require('../meta.json');
No errors!

Thank you very much for checking it! :)

贡献者指南