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

support for JavaScript modules #101

Open
declann opened this issue Mar 18, 2024 · 2 comments
Open

support for JavaScript modules #101

declann opened this issue Mar 18, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@declann
Copy link

declann commented Mar 18, 2024

Hi,

I'm interested in running JavaScript code that uses JS modules, including remote imports like
import { memoize } from 'https://cdn.jsdelivr.net/npm/underscore/+esm';

but I get the error
SyntaxError: Cannot use import statement outside a module

I can get this to work in STPyV8 by making an old-school bundle (or adapting the bundler made by @liran-funaro in issue #60 !)

However, V8 does support JavaScript modules, so I wonder if there's a way for STPyV8 to support this, how tricky it might be and if there is an interest in develop it?

I guess that this might be mostly just providing a switch, similar to the --input-type flag in nodejs.

Thanks!
Declan

@buffer buffer self-assigned this Apr 16, 2024
@buffer buffer added the enhancement New feature or request label Apr 16, 2024
@buffer
Copy link
Collaborator

buffer commented Apr 16, 2024

I am well aware of the issue and would like to fix it soon or later. But unfortunately I will not be able to do that soon due to lack of time. I will keep the issue open as a reminder for myself that I have to take care of that.

@buffer buffer added the help wanted Extra attention is needed label Apr 16, 2024
@himakshi25
Copy link

Hi @buffer , I am trying to import node-fetch and getting similar issue

SyntaxError: SyntaxError: Cannot use import statement outside a module ( @ 1 : 0 ) -> import fetch from 'node-fetch';

Is this issue being worked upon or yet to be picked in near future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants