dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.91k stars 389 forks source link

Can't load javascript library #3686

Closed pkese closed 1 month ago

pkese commented 1 month ago

Describe the bug

I'm trying to load a JS library (in javascript kernel) following documentation
https://github.com/dotnet/interactive/blob/main/docs/javascript-overview.md#loading-dependencies
but nothing works.

Here's what I tried:

MarkdownIt = await import('https://cdn.jsdelivr.net/npm/markdown-it@14.1.0/+esm');
console.log(MarkdownIt);

(prints empty object: {})

configuredRequire = (require.config({
    paths: {
        markdownIt: 'https://cdn.jsdelivr.net/npm/markdown-it@14.1.0/dist/markdown-it.min.js',
    },
}) || require);

configuredRequire(['markdownIt'], markdownIt => {
    console.log(markdownIt);
});

(nothing happens)

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

NET Interactive
© 2020 Microsoft Corporation
Version: 1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074
Library version: 1.0.0-beta.24229.4+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074
Build date: 2024-04-29T22:23:22.0000000Z

Screenshots

If applicable, add screenshots to help explain your problem.

pkese commented 1 month ago

Also it would be nice if the documentation explained how to load javascript files (or modules) from local disk.