Skip to content
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

ASSETS #1

Closed
garronej opened this issue May 15, 2020 · 20 comments
Closed

ASSETS #1

garronej opened this issue May 15, 2020 · 20 comments

Comments

@garronej
Copy link
Owner

No description provided.

@garronej
Copy link
Owner Author

ts_ci

@garronej
Copy link
Owner Author

Screenshot 2020-05-16 at 12 04 25

@garronej
Copy link
Owner Author

garronej commented May 16, 2020

Watch the video

@garronej
Copy link
Owner Author

Screenshot 2020-05-16 at 12 21 04

@garronej
Copy link
Owner Author

serve php

@garronej
Copy link
Owner Author

image

@garronej
Copy link
Owner Author

garronej commented May 17, 2020

image

@garronej
Copy link
Owner Author

npmjs com

@garronej
Copy link
Owner Author

garronej commented Nov 4, 2020

image

@garronej
Copy link
Owner Author

82094662-cd17c200-96fd-11ea-8645-808344bad951

@garronej
Copy link
Owner Author

82094662-cd17c200-96fd-11ea-8645-808344bad951

@garronej
Copy link
Owner Author

82094662-cd17c200-96fd-11ea-8645-808344bad951

@garronej
Copy link
Owner Author

image

@garronej
Copy link
Owner Author

image

@garronej
Copy link
Owner Author

garronej commented Aug 1, 2021

image

@garronej
Copy link
Owner Author

garronej commented Aug 1, 2021

image

@garronej
Copy link
Owner Author

garronej commented Aug 1, 2021

ts-ci

@garronej
Copy link
Owner Author

garronej commented Dec 1, 2021

image

@garronej
Copy link
Owner Author

garronej commented May 21, 2023

Use project reference to compiles your script in CJS and the rest of your lib in ESM. It's the strategy implemented by keycloakify and react-dsfr.

@garronej
Copy link
Owner Author

Confused notes about module publishing:

If you don't have any dependencies or it's not important if your dependency are duplicated or you dependencies are only released in CJS and you are not levraging import().then(..):
Release in CJS + ESModule interop.
And you don't use export default.
Example: https://github.com/garronej/evt

If your module has no scripts (you do not expose CLI tools) and you don't care about suporting node in type: module mode (MUI dosen't). It's OK for a react library for example. You can just release in ESM (just by setting target ES6)
If you opt for this option you must tell JEST to transpile your package
https://react-dsfr.etalab.studio/
Example: https://github.com/InseeFrLab/onyxia-ui
(If you pulblish scripts you can have src/bin transpiled in CJS and the rest transpiled in ESM, remember that files transpiled in ESM will be able to import files transpiled in CJS but not the other way around. Example: react-dsfr, keycloakify)

You want to support every environement including node in "type: module" and you have dependencies that release both in EJS and ESM that can't be duplicated but you don't use export default.
Publish in both ESM (for bundlers) and CJS Intercompat (For node). List your exports.
Example: TSS React

If you are in the previous case AND you use export default. Then it's you must list your export like
exports: {
"..":{
"module" -> ESM
"import": -> an .mjs file in ESM format that rexport everything from your CJS distribution, including the default. Emotion does this
"default": -> CJS ESMInterop
}
}
I don't have example because I don't have to do it.

Now if you want that, on node async import work as well then you have to publish a Real ESM distribution standard compliant.
This is only possible if all your dependencies publish ESM distribution compatiblie with node and it increase the likelyood dual package hasard.

If your package need async features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant