-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support flow:main in manifest #2675
Comments
@STRML About your comment on the PR, |
You might don't need to look for {
"main": "./lib/index.js",
"module": "./esm/index.js",
"files": ["lib", "esm", "src"],
"scripts": {
"build:flow": "echo \"// @flow\\n\\nexport * from '../src';\" > lib/index.js.flow"
}
} |
I think that's what he was addressing under "The workaround". It's certainly an option some libraries are taking, but it feels hacky and potentially increases |
@wtgtybhertgeghgtwtg How this increases bundle size? |
Also there is #5729 with similar feature, so this can be closed /cc @vkurchatkin |
Sorry, I meant package size. |
Package size? With a few bytes? Who cares? My way is pretty good for this without any new fields in package.json. |
Yeah, I completely misinterpreted what the script did. I still feel that this would be a better solution, but I'm going to start using that script. |
The problem is that own entry point does not solve necessary cases. For example: import map from 'lodash/map' requires |
After trying out all of the popular third party fixes for this issue, I would like to state that all of them have their quirks. It feels unnecessary to have to create There are some use cases where we want interop between TS/Flow and maybe even others, but that's a special case and I think But the original issue was about being able to require your dependencies, that all use flow, and having first party support in package.json to point flow to the source files, that babel itself is compiling from. It would solve cases like lerna/lerna#891 #5975 among others. Using third party tools to map source files to |
I've opened a PR to fix this in #6504 |
(I searched for an existing issue but couldn't find one so sorry if this is a duplicate)
The problem
The problem is that we want flow to understand the types of flow-typed modules correctly when requiring them.
The workaround
We currently have to keep
.flow
files along with.js
files after they are babel compiled and that adds an extra build step and a ton of headache.The solution
If Flow has support for
flow:main
(likejsnext:main
for rollup), we would not have to add anything new to our build step. We can just leave thesrc
dir in our npm package and setflow:main
tosrc/
.This is a follow up to #1459
The text was updated successfully, but these errors were encountered: