embedding a notebook --> import.meta

Hi :wave:

I am currently trying to build some sort of portfolio / personal website and want to embed my notebooks. I followed the instructions from this notebook, but i am not using create-react-app. Instead i wanted to try parcel + react.

If I try to import one of my notebooks e.g.

import parametricSurfaces from '@timhau/parametric-surfaces';

i get an error:

Uncaught SyntaxError: Cannot use 'import.meta' outside a module

which i can obviously fix by adding a type="module" attribute to my script tag. But as this is not supported in older browsers i am looking for an alternative.

Can it be resolved with a webpack / create-react-app setup or is there another work around?

Thanks in advance
Tim

Hi @tau, I guess this topic was covered here before, particularly using webpack and create-react-app .

and here is my hack

they all rely on download and edit the source code of your notebook

maybe you can code a custom loader to fix import.meta I’m not familiar with parceljs

thanks @radames :),
i think i will switch to webpack and sorry for the duplication.

Cool that works for you!