-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Simplify build in 3.0.0 #1525
Comments
Hi @gcanti, if you think the distinction between Instead of placing In addition to that, thanks to conditional exports, If we adopt them, the {
"exports": {
"import": "./es6/index.js",
"require": "./lib/index.js",
"./Alt": {
"import": "./es6/Alt.js",
"require": "./lib/Alt.js"
},
// ...
}
} Though the current "multiple package.json" style works well, there is a problem decreasing developers' experience: the language server inserts an import statement not from |
^ I was playing about with this for fp-ts-std. I haven't tested it much yet but it's worth seeing if we could take advantage of wildcards in conditional exports: {
"exports": {
"./*": {
"require": "./lib/*.js",
"import": "./es6/*.js"
}
}
} Edit: In use over there as of 0.12! |
@ryota-ka Great suggestion! This is one of the things I would really like to see in |
I also think this makes a lot of sense to do. Typescript should understand package.json exports in their next release. |
@gcanti I tried it with
Aside, files under |
I've noticed in My approach was to unify each around the minimum of browser support and Node.js support however I may have overlooked something. |
As mentioned by @ryota-ka, current in: Lines 39 to 44 in 799d80b
change to: exports: {
'.': './cjs/index.js',
'./*': { It's not ideal but at least gains interoperability from ESM to CommonJS. |
Version 3.0.0 comes with an improved build process.
Currently it does some code patching of import statements, as the output file structure gets modified.
The reason for this is that every module needs to exists inside a directory, as it contains a "packaga.json", and source files for "lib", "es6" as well as "d.ts" typings.
E.g. see:
https://github.com/gcanti/fp-ts/blob/3.0.0/scripts/build2.ts#L49
The path of the "Alt" module is rewritten to "Alt/Alt".
I was wondering if the code rewriting can be omitted when paths are normalized like so:
src/foo/bar/baz.ts -> dist/foo/bar/baz/index.js
Looks like less intrusive, but maybe I oversee something.
The text was updated successfully, but these errors were encountered: