facebook / facebook/flow

Cannot resolve JSON file starting with a dot

Open
#7,673 13 comments 0 reactions 0 assignees View on GitHub
bug good first issue Has PR module resolution
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Flow version:

```
version 0.97.0
```

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

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

It results in this error:

```text
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:

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

```text
No errors!
```

Thank you very much for checking it! :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.