facebookarchive / flux

Application Architecture for Building User Interfaces
https://facebookarchive.github.io/flux/
Other
17.44k stars 3.47k forks source link

Flow: "FluxStore. Required module not found" (and many more) #417

Closed dperetti closed 7 years ago

dperetti commented 7 years ago

With:

    "flow": "^0.2.3",
    "flux": "^3.1.2"

How to reproduce:

create-react-app fluxflow
cd fluxflow
yarn add flow flux flow-types flux-bin
flow init
flow

Output:

node_modules/flux/lib/FluxContainer.js.flow:15
 15: import type FluxStore from 'FluxStore';
                                ^^^^^^^^^^^ FluxStore. Required module not found

node_modules/flux/lib/FluxContainer.js.flow:17
 17: const FluxContainerSubscriptions = require('FluxContainerSubscriptions');
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FluxContainerSubscriptions. Required module not found

node_modules/flux/lib/FluxContainer.js.flow:21
 21: const shallowEqual = require('shallowEqual');
                                  ^^^^^^^^^^^^^^ shallowEqual. Required module not found

node_modules/flux/lib/FluxContainerSubscriptions.js.flow:14
 14: import type FluxStore from 'FluxStore';
                                ^^^^^^^^^^^ FluxStore. Required module not found

node_modules/flux/lib/FluxContainerSubscriptions.js.flow:16
 16: const FluxStoreGroup = require('FluxStoreGroup');
                                    ^^^^^^^^^^^^^^^^ FluxStoreGroup. Required module not found

node_modules/flux/lib/FluxContainerSubscriptions.js.flow:35
 35:     if (__DEV__) {
             ^^^^^^^ identifier `__DEV__`. Could not resolve name

node_modules/flux/lib/FluxMixinLegacy.js.flow:14
 14: import type FluxStore from 'FluxStore';
                                ^^^^^^^^^^^ FluxStore. Required module not found

node_modules/flux/lib/FluxMixinLegacy.js.flow:16
 16: var FluxStoreGroup = require('FluxStoreGroup');
                                  ^^^^^^^^^^^^^^^^ FluxStoreGroup. Required module not found

node_modules/flux/lib/FluxReduceStore.js.flow:14
 14: import type Dispatcher from 'Dispatcher';
                                 ^^^^^^^^^^^^ Dispatcher. Required module not found

node_modules/flux/lib/FluxReduceStore.js.flow:16
 16: const FluxStore = require('FluxStore');
                               ^^^^^^^^^^^ FluxStore. Required module not found

node_modules/flux/lib/FluxReduceStore.js.flow:18
 18: const abstractMethod = require('abstractMethod');
                                    ^^^^^^^^^^^^^^^^ abstractMethod. Required module not found

node_modules/flux/lib/FluxStore.js.flow:14
 14: import type Dispatcher from 'Dispatcher';
                                 ^^^^^^^^^^^^ Dispatcher. Required module not found

node_modules/flux/lib/FluxStoreGroup.js.flow:15
 15: import type Dispatcher from 'Dispatcher';
                                 ^^^^^^^^^^^^ Dispatcher. Required module not found

node_modules/flux/lib/FluxStoreGroup.js.flow:16
 16: import type FluxStore from 'FluxStore';
                                ^^^^^^^^^^^ FluxStore. Required module not found

node_modules/flux/lib/FluxStoreGroup.js.flow:54
 54:   if (__DEV__) {
           ^^^^^^^ identifier `__DEV__`. Could not resolve name
kyldvs commented 7 years ago

Sounds like an issue with create-react-app fluxflow here is the example demonstrating how to set up Flux+Flow: https://github.com/facebook/flux/tree/master/examples/flux-flow

If something is wrong with that example let me know

dperetti commented 7 years ago

It should work without any additional configuration, that's the point. Moreover, that example apparently suggests to ignore everything in node_modules, which I believe is not recommended anymore. Looks more like a hack than a proper implementation.

rnons commented 6 years ago

In https://github.com/facebook/flux/blob/master/examples/flux-flow/flow/flux-utils.js#L35, it is

declare class ReduceStore<TPayload, TState> extends Store<TPayload> {
  reduce(state: TState, action: TPayload): TState;

But in node_modules/flux/lib/FluxReduceStore.js.flow, it is

class FluxReduceStore<TState> extends FluxStore {
  reduce(state: TState, action: Object): TState {

Why are they different?