jspm / generator

JSPM Import Map Generator
Apache License 2.0
166 stars 21 forks source link

Multi-page workflows #136

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

When working with applications that are multiple HTML pages, running generation over each page as its own top-level process can be slow.

We should have a way to do bulk processing and management of versions over multiple HTML pages in an easy way that is performant.

zachsa commented 2 years ago

I have found in some cases that generating a single import map can be slow - not related to multiple import maps.

to replicate:

git clone git@github.com:SAEON/somisana.git test-jspm
cd test-jspm/web
npm install

# Run the whole chomp pipeline (build client app)
chomp 

# Then kill the process and generate only the Node.js import map
chomp jspm:node

There is a file index.importmap.js:

// SERVER
import './server/index.js'

// CLIENT
import './.cache/ssr.algoa-bay-forecast.js'
import './.cache/ssr.false-bay-forecast.js'
import './.cache/ssr.somisana.js'
import './.cache/ssr.atlas.js'

It takes a long time to build this:

  node.importmap invalidated
🞂 node.importmap
√ node.importmap [8.9612442s]
guybedford commented 2 years ago

We now have generator.extractMap in https://github.com/jspm/generator/pull/134 which can provide multi-build workflows quite nicely, by extracting submaps from a larger single install map.

Integrating generator.extractMap style semantics into htmlGenerate would be worth exploring further.

Separately, performance optimization work is being tracked in https://github.com/jspm/generator/issues/140.