Trying to get Google Playgrounds to work with served CDN libraries

Hi, I’m trying to use Google Playgrounds library to create code sandbox for code examples.
Link to github:
GitHub - google/playground-elements: Serverless coding environments for the web.

So far I have:

  1. this in head:
    <script type="module" src=" "></script>

  2. and inside body:

  <script type="sample/html" filename="index.html">
    <!doctype html>
      <script type="module" src="javascript.js">&lt;/script>
      <script type="module" src="typescript.js">&lt;/script>
      <link rel="stylesheet" href="styles.css">
      <p>Hello World!</p>

  <script type="sample/js" filename="javascript.js">
    console.log('hello from javascript');

  <script type="sample/ts" filename="typescript.ts">
    console.log('hello from typescript');

  <script type="sample/css" filename="styles.css">
    body { color: blue; }

But I’m getting this error in the console:

Uncaught TypeError: The specifier “tslib” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “…/” or “/”.

Any help is appreciated.

Here the solution

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.