Comments (6)
If doing so, I think we should do so in the open by getting consensus from the SWG. That'll give anyone with a CJS issue a chance to come forward before the release and for us to work out a solution if one is needed (such as an optional legacy build).
I too doubt most will have issues and few will complain about a smaller module!
from fdc3.
from fdc3.
from fdc3.
My limited understanding is that the current module contains both:
https://unpkg.com/browse/@finos/[email protected]/dist/
and I would assume its not backwards compatible to move to ESM only... but again I'm no expert on that topic. @julianna-ciq or @thorsent might know more.
from fdc3.
TLDR; either configure rollup to produce both commonjs and esm (if you want to be a good citizen), or just go with esm (you'll be fine)
The approach taken by most libraries these days is to produce both commonjs and esm. Rollup can do this pretty easily (the "main" entry in package.json points to the cjs version, while the "module" entry points to the esm version).
Some libraries have chosen to only support esm (an effort to strong-arm the world into moving forward), so people are learning to deal with it.
In general, commonjs is only necessary for node (and usually only in legacy situations). On the web, browsers already support esm as do all the major bundlers. Node however is very persnickety about esm , requiring either that all modules are esm (via a switch) or that modules specifically identify themselves using the .cjs and .mjs notation to indicate their module type.
We most often see this issue rear its head when building unit tests, since mocha and JEST run in node. Anyone in the world who has incorporated the FDC3 library, or needs to incorporate the FDC3 library, in a mocha suite that isn't configured for esm will have issues (as they will with many other public libraries - the solution usually being to use an older version...)
Typically, if you don't have a commonjs option then you have to go "all in" on esm in node in your unit test pipeline, which means including extensions in your imports:
import "../mymodule.js"
instead of import "../mymodule"
This syntax change gives a lot of people heart palpitations, because "mymodule.js" may actually refer to a file named "mymodule.cjs"! I think this is the major reason why we're not all running esm already. Personally, I've found that it's just something to get used to.
from fdc3.
That's brilliant, @thorsent. Also it agrees with @Lecss 's view that we should "move to ES6 and wait until someone complains".
from fdc3.
Related Issues (20)
- Standard WG Meeting - August 22nd, 2024 HOT 8
- Add .NET docs for Events to API reference HOT 1
- GetAgentParams Not Optional HOT 1
- App Liveness Check HOT 15
- FDC3 for Web Browsers Discussion group 29th Aug 2024 HOT 7
- FDC3 Identity & Threat Modelling -29 August 2024 HOT 2
- Question: DOM Projection for UX parts. HOT 5
- General Meeting - September 3rd, 2024 HOT 5
- Question: Handling IntentResult HOT 6
- Question: RaiseIntentResultResponse requestUuid and source HOT 14
- Matching identityUrls to appD records for FDC3 for the Web HOT 6
- Question: adding BrowserTypes to root export HOT 13
- Support better identity validation in Preload Desktop Agents HOT 1
- Use Cases and Workflows Discussion Group - 5th September 2024 HOT 6
- use consistent field names in WCP1Hello and WCP3Handshake HOT 3
- Question: addEventListener() type parameter conflict HOT 5
- Question: How does a context from open(app, context) interact with broadcasting? HOT 2
- Identity and Security WG Meeting - Sep 12, 2024 HOT 7
- Support broadcast in FDC3 Action
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fdc3.