Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using modules #425

Open
jchrom opened this issue Feb 19, 2022 · 0 comments
Open

Using modules #425

jchrom opened this issue Feb 19, 2022 · 0 comments

Comments

@jchrom
Copy link

jchrom commented Feb 19, 2022

Perhaps this is just an instance of a larger issue, maybe related to #405 but not quite the same (I don't get the MIME type of "text/plain" error).

I am able to run my code with live-server without issue. I packaged it into an htmlwidget and tried to run it in an Rmd file with runtime: shiny. I get no output, and I get this in the console:

Uncaught SyntaxError: import.meta may only appear in a module

The import.meta does appear in my /lib/library.min.js file, but this error only happens when trying to render the htmlwidget.

Running the same code outside of the htmlwidgets context, i.e. having a js file with import Thing from "/some/lib.js;" and then <script type="module" src="/my-script.js"></script> in my index.html works perfectly using live-server.

I will be happy for even a high-level explanation of what might be going on here, or where to look for solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant