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

Add package.json subpath export for cjs and esm #195

Merged
merged 11 commits into from
Aug 16, 2023
Merged

Conversation

AnDuong249
Copy link
Contributor

@AnDuong249 AnDuong249 commented Aug 14, 2023

  • Update typescript to 5.0.4 to support package.json export field.
  • Export ElectronMain cjs and ElectronRenderer esm
  • Added separate tsconfig file for cjs and esm builds

Users can export from ElectronRenderer and ElecctronMain like this when using moduleResolution: node16

import { ElectronRendererAuthorization } from "@itwin/electron-authorization/lib/esm/ElectronRenderer";
import { ElectronMainAuthorization } from "@itwin/electron-authorization/lib/cjs/ElectronMain"

or like this when using moduleResolution: "node16/nodenext/bundler"

import { ElectronRendererAuthorization } from "@itwin/electron-authorization/Renderer";
import { ElectronMainAuthorization } from "@itwin/electron-authorization/Main"

AnDuong249 and others added 2 commits August 15, 2023 11:13
…port_2023-08-14-22-00.json

Co-authored-by: Arun George <11051042+aruniverse@users.noreply.github.com>
@aruniverse
Copy link
Member

@AnDuong249 can you test out the bundler module resolution too ? https://www.typescriptlang.org/tsconfig#moduleResolution

@ben-polinsky
Copy link
Collaborator

import { ElectronRendererAuthorization } from "@itwin/electron-authorization/ElectronRenderer";
import { ElectronMainAuthorization } from "@itwin/electron-authorization/ElectronMain"

Could we use just "Main" and "Renderer"? The use of "Electron" seems redundant.

@ben-polinsky ben-polinsky linked an issue Aug 16, 2023 that may be closed by this pull request
@AnDuong249 AnDuong249 marked this pull request as ready for review August 16, 2023 13:55
@AnDuong249 AnDuong249 enabled auto-merge (squash) August 16, 2023 13:56
@AnDuong249 AnDuong249 merged commit a4cc90d into main Aug 16, 2023
8 of 10 checks passed
@AnDuong249 AnDuong249 deleted the ElectronPackageExport branch August 16, 2023 16:09
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

Successfully merging this pull request may close these issues.

Use exports field in package.json over main
3 participants