|
|
|
|
|
by inbx0
1853 days ago
|
|
> which simply cannot be done with ES6 modules because imports will be captured I'm probably misunderstanding the problem here, but perhaps it's worth noting that ES6 module exports declared with let/var can be changed from within the module and the changes reflect to importing modules, even to named imports. // a.mjs
export let counter = 0
setInterval(() => counter++, 1000)
// b.mjs
import { counter } from './a.mjs'
setInterval(() => console.log(counter), 1000)
Logs 1, 2, 3, etc...
At least Webpack also compiles ES modules in a way that keeps this functionality. |
|