Sunil Nair
Sunil Nair

Reputation: 61

TypeError: Failed to resolve module specifier "remarkable". Relative references must start with either "/", "./", or "../"

Have been trying to use the remarkable.js within my application without much success.

script.js

import { Remarkable } from 'remarkable';
var md = new Remarkable();

index.html

<script src="https://cdn.jsdelivr.net/remarkable/1.7.1/remarkable.min.js"></script>
<script type="module" src="js/script.js"></script>

The error is TypeError: Failed to resolve module specifier "remarkable". Relative references must start with either "/", "./", or "../".

Upvotes: 0

Views: 708

Answers (1)

J&#233;r&#233;mie B
J&#233;r&#233;mie B

Reputation: 11022

If you use the cdn script, you can't "import" remarkable, but it will be available globally. You can import it if you use bundler like webpack or rollup.

just do:

var md = new Remarkable();

Upvotes: 4

Related Questions