facebook/flow

Cannot resolve JSON file starting with a dot

Open

#7673 aperta il 26 apr 2019

Vedi su GitHub
 (13 commenti) (0 reazioni) (0 assegnatari)Rust (1885 fork)batch import
Has PRbuggood first issuemodule resolution

Metriche repository

Star
 (22.203 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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! :)

Guida contributor