Skip to content

Conversation

@jimmycallin
Copy link
Contributor

  • I have added automatic tests where applicable
  • The PR title is suitable as a release note
  • The PR contains a description of what has been changed
  • The description contains manual test instructions

Changes

Without setting type: "module", the library couldn't be imported as es module. This caused it to throw the following error when trying to import { Session } from an ES module:

SyntaxError: Named export 'Session' not found. The requested module '@ftrack/api' is a CommonJS module, which may not support all module.exports as named exports. 

By changing the name of the umd package to use cjs file ending, it is still working properly as a CJS module as well, not causing any breaking changes.

Test

Try to import it in both a CJS and ESM setting, making sure it's working as expected in both.

Example:

test.mjs:

import { Session } from "@ftrack/api"; 

test.cjs:

const { Session } = require("@ftrack/api"); 
@jimmycallin jimmycallin requested a review from a team as a code owner March 30, 2023 20:57
@jimmycallin jimmycallin requested a review from gismya March 30, 2023 20:57
@jimmycallin jimmycallin merged commit 872ccca into main Mar 31, 2023
@jimmycallin jimmycallin deleted the type-module branch March 31, 2023 07:15
gismya pushed a commit to gismya/ftrack-javascript that referenced this pull request Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants