-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Converted Certificate Sample to TypeScript #7368
Conversation
samples/msal-node-samples/client-credentials-with-cert-from-key-vault/tsconfig.json
Show resolved
Hide resolved
@@ -6,4 +6,5 @@ | |||
module.exports = { | |||
displayName: "Client Credentials with Certificate from Key Vault", | |||
preset: "../../e2eTestUtils/jest-puppeteer-utils/jest-preset-no-setup.js", | |||
extensionsToTreatAsEsm: [".ts", ".tsx"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting some build errors without this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an old run? It's referencing jest.config.js
being treated as ESM but the file is, correctly, named jest.config.cjs
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is an old run. I receive that error when the file ends with ".js" instead of ".cjs". I can Google the difference I suppose, but for the purpose of discussion here, what is the ;TLDR difference between the two?
I can try keeping the file as ".cjs" and removing that line you asked the question about, and see if I still receive the build error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different module formats. If you've specified type: "module"
in the package.json, .js
file extensions are treated as ESM. Without the type
specified .js
extensions are treated as CJS. To explicitly use CJS or ESM use .cjs
or .mjs
respectively. In this case the config is written using CJS syntax so it either needs to use .cjs
or remove type: "module"
from the package.json
This is the first time we'll have an E2E test running on a TypeScript sample. They all currently run on JS samples.