Intermediate SplitStyle mode
See original GitHub issueI have been trying to use snowpack
with scala.js new split modules in development mode.
This is really meant for development mode where I want to change code in my application and want to see the results as soon as possible in the browser. A tool like snowpack
is able to detect what changed and only load those
I tried the setting:
scalaJSLinkerConfig ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules)),
And that will create modules for each class and indeed only the few that change will be updated and captured by snowpack
However for my test application there is a large set of modules, in my case 3172 files including e.g. one for each scala class in use, or dependencies like scalajs-react
ls -al target/scala-2.13/seqexec_fastopt/
...
-rw------- 1 cquiroz staff 11819 Dec 11 14:28 japgolly.scalajs.react.extra.router.RoutingRules.js
...
-rw------- 1 cquiroz staff 25248 Dec 11 17:25 web.client.table.package$.js
...
-rw------- 1 cquiroz staff 1190 Dec 11 14:28 java.lang.ThreadLocal.js
...
Though snowpack
only detects the changed files, the sheer amount of files means it needs to check a lot of files and it also puts pressure on the browser as well (needing to track thousands of modules).
What would be great (I have no idea how involved this is) is to have modules grouped, e.g. all from dependency X into an X.js
and keep the application classes split, this would let the dev tool to load application files as they change, while caching dependencies grouped in “bigger” files
I don’t if this is feasible but I’ll open this to discuss
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:36 (34 by maintainers)
Top GitHub Comments
I did a quick test an for one of my apps we went from 2401 files to 74. Also the load time in browser went from some secs to negligible. Thanks a lot for this feature I think it will be of extremely useful
TY 😃 Also took me over half a year to build 😛