Hello!
Requiring lodash was working until yesterday, but today suddenly I am getting an invalid module error:
I’ve checked lodash and they haven’t had any updates in a few months, and I also tried Tom’s module debugger which resulted in an undefined:
_ = require(‘lodash@4.17.11/lodash.js’).catch(() => window._)
_ = undefined
I’m wondering if there’s any changes on Observable’s end that’s causing this?
Looks like a bug or regression on jsDelivr’s side. The require() method uses jsDelivr as a middleman to request npm package contents over http, and the lodash package resource this call results in ( https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.js ) is truncated, which is why it’s invalid JavaScript, not just an invalid module. I just filed an issue with jsDelivr to try and get to the bottom of the issue.
In the meantime, you can work around the issue by using unpkg instead: