-
Notifications
You must be signed in to change notification settings - Fork 43
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 ESM modules with airtap #294
Comments
A browserify transform or plugin, like babel or esmify, should do the trick. Unless you want to test real ESM in browsers, then I'm not sure. |
We also want to test real ESM in the browser |
I haven't used real ESM before, some guidance is welcome. First thoughts: I suppose airtap would have to serve the user's input files as-is without bundling them, acting as a static file server. The client could then load those files either by appending Currently we serve a bundle at Which directory should we serve? For example given
Sound good so far? |
sounds good so far. There is also the possibility of using import maps for node_modules |
Are there any good (simple and unopinionated) npm packages to help us create import maps? Or (if there are other caveats besides import maps) a general solution for serving ESM files? I'm looking for small building blocks, rather than a full framework or bundler like snowpack. |
seems like specifying browserify:
- plugin: 'esmify' inside .airtap.yml mostly fixes this except for type assertion, for browserify CLI doing |
browserify:
- transform: babelify
presets: ['@babel/preset-env']
plugins: ['@babel/plugin-syntax-import-assertions'] |
this doesn't seem to work for me, even tho it parses it |
@vweevers |
My example was just to show how to specify transform options. The complete configuration should also include esmify. |
I see. OK, then I can't be of further assistance. You now know how to specify options in |
|
@vweevers welp, feel free to add this to the readme To compile ESM tests and modules to your browserify:
- transform: babelify
global: true
presets: ['@babel/preset-env']
plugins: ['@babel/plugin-syntax-import-assertions'] make sure that your root package.json does not have any |
When using this I get: |
Hello there!
I'd like to use airtap with es6 modules, however I couldn't find a way yet.
I tried the following script:
"test": "airtap --local -r esm src/test/*.test.js"
It looks like airtap ignores the esm flag. Could you please recommend a way to get it working?
Thanks
The text was updated successfully, but these errors were encountered: