question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@giphy/js-components Compiling to Javascript

See original GitHub issue

I have a website that I have only used JavaScript with, but I tried using TypeScript as per the example on CodeSandbox. The problem I am having is that the browsers are not compiling the code correctly. Some of the errors I have encountered are: “chat.ts” was blocked because of a disallowed MIME type (“video/mp2t”)” //chat.ts is basically the same code as index.ts in the CodeSandbox example After installing TypeScript through npm and creating the js files I get this error: “ReferenceError: exports is not defined” in chat.js (source of error: Object.defineProperty(exports, "__esModule", { value: true });) This code was generated by running tsconfig.json in Visual Studio Code

I know how to program with TypeScript, but the problem is that I don’t know how to compile in the browser. I’ve tried researching this but had no luck. What am I missing?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
giannifcommented, Feb 5, 2021

@maltoze it’s possible, just most people use a bundler and it hasn’t been on our roadmap. I’d have to add a umd file to our package.json and then it looks like you’d be able to use https://unpkg.com/ to grab the code in a script tag

0reactions
maltozecommented, Feb 5, 2021

Ah I may have mislead you about tsc, we use that for our repo, but that is for our libraries, not for a bundle you’d use in a web page.

Take a look at https://parceljs.org/

It should be easy to get the bundled file you need for use with a script tag.

Why doesn’t provide a version that can be used directly in <script>?

Read more comments on GitHub >

github_iconTop Results From Across the Web

@giphy/js-components - npm
A lightweight set of components, focused on easy-of-use and performance.. Latest version: 5.10.1, last published: 6 days ago.
Read more >
Adding giphy-js to vanilla JavaScript project - Stack Overflow
I want to use Giphy SDK to my vanilla JavaScript project. ... https://github.com/Giphy/giphy-js/blob/master/packages/components/README.md.
Read more >
Demo Application - Integrate the GIPHY API in JavaScript
Learn to integrate the GIPHY's SDK to build a React application. We'll cover the following. GIPHY's SDK and React components; Application workflow ...
Read more >
Gif searching app in plain javascript using GIPHY API - YouTube
The video is a code challenge where we will be creating a small app using GIPHY API.The app has a search input and...
Read more >
Build a GIF Search Engine in Just 10 Minutes
JavaScript brings dynamicity to a web page, like you may set some instructions on clicking a button or every time when the user...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found