kiota-typescript icon indicating copy to clipboard operation
kiota-typescript copied to clipboard

evaluate whether we still need commonjs support

Open baywet opened this issue 1 year ago • 7 comments

Since we originally stood up this library the ecosystem has moved a lot:

  • nodejs supports ESM, and all supported versions have them enabled by default now
  • major community projects have moved to ESM only, including some in our build infrastructure (see #1041 where we can't upgrade to chai 5 because we still have commonjs based tests)
  • we've established that the sub modules we have (fluent API, sub-namespaces for models...) can only be consumed in ESM (when the generated client is published as its own package) when working on msgraph-sdk-typescript.
  • we're still on the 2.X branch of node-fetch because 3.X moved to ESM

IMHO we should remove commonjs support after testing our main scenarios (SPFx, TeamsFX....) and BEFORE the GA so people don't end up in confusing variants + configuration misalignment issues.

baywet avatar Feb 01 '24 18:02 baywet

@gavinbarron @musale I'd love your input on this one when you have a couple of minutes.

baywet avatar Feb 21 '24 14:02 baywet

I agree with removing cjs support all together. You have made valid points to remove it. ESM has more desirable benefits like tree-shaking which helps developers bundle smaller sizes of the sdk in their apps. In the core https://github.com/microsoftgraph/msgraph-sdk-typescript-core repo, this has already been done. In mgt, we removed it and directed using module syntax in the browser when loading mgt from the cdn https://github.com/microsoftgraph/microsoft-graph-toolkit/releases/tag/v4.0.0.

musale avatar Feb 22 '24 14:02 musale

@sebastienlevert I think we have an agreement on the engineering side for this one. Especially since it's blocking other work. Any opposition to removing common is support here?

baywet avatar Mar 18 '24 12:03 baywet

No. We should definitely drop it at this point.

sebastienlevert avatar Mar 18 '24 17:03 sebastienlevert

Thanks for your input. @musale please proceed as part of your existing PR.

baywet avatar Mar 18 '24 17:03 baywet

Decision is to drop commonjs support.

sebastienlevert avatar Mar 20 '24 20:03 sebastienlevert

Wait, we still need to do some work to remove it

baywet avatar Mar 20 '24 20:03 baywet