Help loading library - ScatterGL

Hello all,

I’ve been trying to run this cool 2d/3d scatter plot based on Three.js scatterGL on Observable, and I came across some errors.

Loading it from npm

I get this error

SCATTERGL = vt: unable to load package.json

The way the lib is bundled using webpack, it adds Three.js as externals

Then Observable try to load Three.js package.json from, using the external global name.

which is not the correct name for Three.js package

Is there any way I can overwrite Observable loading Three.js from the wrong location?
What would be a good way to bundle that library to work on Observable? Thinking of loading Three.js separated from scatterGL?

If you add the libs as script tags, it works fine

<!-- Load three.js -->
<script src=""></script>
<!-- Load scatter-gl.js -->
<script src=""></script>

ps. If you use it bundles an incompatible Three.js version with OrbitControls and the error is different and unrelated to Observable

I think require.alias should help.

Hi @j-f1 amazing! worked so easily. I can’t understand how I’ve missed it from the documentation!

I did

SCATTERGL = await require.alias({
  THREE: "three@0.106.2/build/three.min.js"