0

I'm trying to use makerjs on my javascript with using cdn which is

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>
</head>
<body>
    <script src="https://cdn.jsdelivr.net/npm/makerjs@0/target/js/browser.maker.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bezier-js@2/bezier.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/opentype.js@0/dist/opentype.js"></script>
</body>
</html>

I putted this code on my index.html code, and I have nothing on my web page.

However, when I use with codepen with only this code bellow,

<script src="http://maker.js.org/target/js/browser.maker.js" type="text/javascript"></script>
<script src="https://pomax.github.io/bezierjs/bezier.js" type="text/javascript"></script>
<script src="http://opentype.js.org/dist/opentype.js" type="text/javascript"></script>

has no problem with rendering a page. But if I use the first one with vscode, it is not rendering anything.

The index.js file is like this.

var makerjs = require('makerjs');

var line = { 
  type: 'line', 
  origin: [0, 0], 
  end: [50, 50] 
 };

var svg = makerjs.exporter.toSVG(line);

document.write(svg);

What is the problem with not rendering the page with cdn adress?

Sophia Lee
  • 37
  • 8

0 Answers0