'How to use @solana/spl-token in vanilla JS after importing in HTML using CDN?

I am trying to use @solana/spl-token(https://www.npmjs.com/package/@solana/spl-token) npm module with the below react implementation and convert it to vanilla js accessing it via CDN(https://www.jsdelivr.com/package/npm/@solana/spl-token) link after importing in HTML.

Unable to access the value of TOKEN_PROGRAM_ID in my vanilla JS code.

React Library usage steps-

Step 1

Able to access here after a successful wallet connection

Step 2


Below is my HTML file-

HTML File

Vanilla JS File- JS File

How can I access the TOKEN_PROGRAM_ID value here after a successful wallet connection?

Any help will be appreciated community.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source