3 ms·
The article doesn't mention 2 and 3, but just as with 1 the module loader spec that is not yet implemented would also happen to help address 2 and 3 by providin
by WorldMaker 11y ago
The article doesn't mention 2 and 3, but just as with 1 the module loader spec that is not yet implemented would also happen to help address 2 and 3 by providing plugin mechanisms to support name mappings like automatic file extensions and mapping canonical module names like 'lodash' to file paths.
- MatthewPhillips 11y agoJust to clarify, the mappings for names to paths isn't enough to load an NPM-based project. With NPM you can have multiple semver-incompatible packages. It's very common to happen, actually. For example, you might depend on "foo" and "bar". "foo" also depends on "bar", but it needs version 1 and you need version 2. In this case, setting paths for "bar" won't work, the paths are different for each parent. The loader spec provides a hook "resolve" that allows you to work around this, just wanted to point out that configuration alone wouldn't be enough. It's also worth noting that the Loader spec doesn't have a real urgency to it. What I mean is that likely browsers will implement script type=module first, give it some time to brew, and then pull in things from whatwg/loader over time. In the meantime we'll want solutions that do allow us to use script type=module and still have modern workflows we are used to.
- WorldMaker 11y agoI would hope that the Loader spec gets a bit more urgency as developers bump into the limitations of script type=module.