So, I'm relatively new to this new MJS based world. I notice that many of the squint interactive demos lean heavily on import maps. Any tips on how import all of the MJS modules in a library or do i need to specify each one manually? In this case, i'd like to explore using https://www.npmjs.com/package/@use-gpu/workbench which seems to export a complete set of MJS module.
you're probably better off to just make a local vite project with squint and compile locally
yes. I agree. although using the modules directly via the import map is very convenient for making playgrounds.
Here is an example from the demo app.
import type { LC, PropsWithChildren } from '@use-gpu/live';
import type { Emit, Time } from '@use-gpu/core';
import React from '@use-gpu/live';
import {
Pass,
OrbitControls, OrbitCamera,
Cursor,
} from '@use-gpu/workbench';
import {
Plot, Point, Line, Tensor, Transform,
} from '@use-gpu/plot';
import { vec3 } from 'gl-matrix';
import { seq } from '@use-gpu/core';
import { InfoBox } from '../../ui/info-box';(require '["react" :as react])
(require '["react-dom" :as rdom])
(require '["@use-gpu/workbench/mjs/index" :as workbench])Although maybe I only have access to things already in the map?
(require '["" :as react])
(require '["" :as hooks]) (require '["react" :as react])
(require '["react-dom" :as rdom])
(require '["" :as workbench])
Failed to fetch dynamically imported module:
TypeError: Failed to fetch dynamically imported module: Okay. So the import works but theres a set of modules i'd need to add to get this to work out of the box - e.g. to add import maps for any of the deps.
Currently stuck on a wasm import. Looks like I might https://github.com/rustwasm/wasm-pack/issues/1432 to get a wasm module to load/initialise in the browser.
"imports": {
"squint-cljs": "",
"squint-cljs/core.js": "",
"squint-cljs/string.js": "",
"squint-cljs/src/squint/string.js": "",
"squint-cljs/src/squint/set.js": "",
"squint-cljs/src/squint/html.js": "",
"@codemirror/language": "",
"@codemirror/lang-javascript": "",
"@codemirror/state": "",
"@codemirror/view": "",
"@codemirror/commands": "",
"@codemirror/autocomplete": "",
"@lezer/highlight": "",
"@lezer/common": "",
"@lezer/javascript": "",
"@nextjournal/lezer-clojure": "",
"@nextjournal/clojure-mode": "",
"@nextjournal/clojure-mode/extensions/eval-region": "",
"@use-gpu/core": "",
"@use-gpu/glyph": "",
"@use-gpu/live": "",
"@use-gpu/parse": "",
"@use-gpu/shader": "",
"@use-gpu/shader/wgsl": "",
"@use-gpu/state": "",
"@use-gpu/traits/live": "",
"@use-gpu/wgsl": "",
"@use-gpu/wgsl/use/view.wgsl": "",
"@use-gpu/wgsl/render/pick.wgsl": "",
"@use-gpu/wgsl/render/sample/equi-to-cube.wgsl": "",
"@use-gpu/wgsl/compute/memo2.wgsl": "",
"@use-gpu/wgsl/pmrem/pmrem-init.wgsl": "",
"@use-gpu/wgsl/pmrem/pmrem-copy.wgsl": "",
"@use-gpu/wgsl/pmrem/pmrem-blur.wgsl": "",
"@use-gpu/wgsl/pmrem/pmrem-diffuse-sh.wgsl": "",
"@use-gpu/wgsl/pmrem/pmrem-debug.wgsl": "",
"@use-gpu/wgsl/pmrem/pmrem-read.wgsl": "",
"@use-gpu/workbench": "",
"lru-cache": "",
"gl-matrix": "",
"earcut": "",
"lodash/uniq.js": "",
"lodash/mapValues.js": "",
"lodash/zip.js": "",
"lodash/zipObject.js": "",
"magic-string": "",
"react": "",
"react/jsx-runtime": "",
"react/jsx-dev-runtime": "",
"react
This is the module that packages a bit of wasm
"@use-gpu/glyph": "", I've tried a few things but haven't gotten WASM loading just right. will revisit tomorrow.