boa-dev / boa

Boa is an embeddable and experimental Javascript engine written in Rust. Currently, it has support for some of the language.
MIT License
5.05k stars 400 forks source link

Import is not working #2503

Open eramax opened 1 year ago

eramax commented 1 year ago

Describe the bug I would like to run react app using boa engine, first I tried to import a package like d3 and found there is an bug, may be the import feature is not ready yet.

To Reproduce

import d3Js from 'https://d3js.org/d3.v3.min.js';

Expected behavior expected to run without an error, and to see the wasm playground loaded through network the d3 package. but I received this error

Uncaught "SyntaxError": "unexpected token 'import', primary expression at line 1, col 1"

Build environment (please complete the following information):

jedel1043 commented 1 year ago

Yeah, the module system is a WIP. See https://github.com/boa-dev/boa/pull/2411 for updates.

jedel1043 commented 1 year ago

This is technically solved by #2922, but the playground won't fetch modules from the web. I'm working on an example on how to asynchronously fetch modules using the new modules API, so we could easily integrate that into our wasm playground.