DEV Community

Discussion on: We reduced our vendor.js from 210kb to 16kb in about five minutes of work and ten lines of code

Collapse
 
rhymes profile image
rhymes • Edited

TLDR; : with transpilation

dev.to uses webpacker which supports dynamic import (it also supports prefetch and preload). This in turn is supported through Babel (a transpiler), with @babel/plugin-syntax-dynamic-import

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

AMD?

Thread Thread
 
rhymes profile image
rhymes

What do you mean?

Thread Thread
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

well, in order to transpile import() you need a way to a) convert modules to scripts and b) dynamically load those scripts.

Sounds like Async Module Definition.

I did a half-hearted poke through the production code, and it looked more like cjs to me. Just curious what kind of 'modules' are actually serving down to clients.