Skip to content

index.js.flow not recognized in scoped module #6134

@hmeerlo

Description

@hmeerlo

I encounter a weird problem which I can not explain. I have a custom scoped npm module called @ftdn/table. It is in node_modules/@ftdn/table:

Hermans-MBP-2:ftdn-import hermanmeerlo$ ls -l node_modules/\@ftdn/table/
total 16
-rw-r--r--   1 hermanmeerlo  staff    92 Apr  4 14:08 README.md
drwxr-xr-x  14 hermanmeerlo  staff   448 Apr 11 12:16 es
drwxr-xr-x  14 hermanmeerlo  staff   448 Apr 11 12:16 lib
-rw-r--r--   1 hermanmeerlo  staff  1225 Apr 11 16:31 package.json

Part of the package.json:

  "name": "@ftdn/table",
  "version": "1.0.5",
  "description": "ftdn-table React component",
  "main": "lib/index.js",
  "module": "es/index.js",
  "files": ["css", "es", "lib", "umd"],

So my build picks up the index.js from the es directory correctly. It builds fine, no problems there. But the es directory contains this:

Hermans-MBP-2:ftdn-import hermanmeerlo$ ls -l node_modules/\@ftdn/table/es/
total 128
-rw-r--r--   1 hermanmeerlo  staff    713 Apr 11 16:31 CardBox.js
-rw-r--r--   1 hermanmeerlo  staff    345 Apr 10 12:04 CardBox.js.flow
-rw-r--r--   1 hermanmeerlo  staff   2700 Apr  4 16:11 Table.test.js.flow
-rw-r--r--   1 hermanmeerlo  staff   5547 Apr 11 16:31 TablePagination.js
-rw-r--r--   1 hermanmeerlo  staff   3075 Apr 11 16:22 TablePagination.js.flow
-rw-r--r--   1 hermanmeerlo  staff   1352 Apr 11 16:31 helpers.js
-rw-r--r--   1 hermanmeerlo  staff   1353 Apr  4 15:44 helpers.js.flow
-rw-r--r--   1 hermanmeerlo  staff  10748 Apr 11 16:31 index.js
-rw-r--r--   1 hermanmeerlo  staff   9472 Apr 10 12:04 index.js.flow
drwxr-xr-x  10 hermanmeerlo  staff    320 Apr 11 12:16 renderers
-rw-r--r--   1 hermanmeerlo  staff    446 Apr 11 16:31 tableTheme.js
-rw-r--r--   1 hermanmeerlo  staff    456 Apr  4 15:35 tableTheme.js.flow

And now Flow complains:

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ demo/src/index.js:8:36

Cannot resolve module @ftdn/table.

      5│ import exampleImg from './example.png';
      6│ import { List, Map } from 'immutable';
      7│ import { TableRow, TableCell } from 'material-ui';
      8│ import Table, { TableColumn } from '@ftdn/table';
      9│ import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
     10│ import Theme from './theme.js';
     11│ import PropTypes from 'prop-types';

This is weird because this directory is not in the [ignore] section of the .flowconfig. I don't understand why Flow doesn't pick up the index.js.flow typedefs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdeclarationsIssues with library definitions or .js.flow features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions