By using aliases for more than just components we can support requiring
files with their full extension so that a JavaScript file and a
template can have the same name with different extensions.
This also sets up main aliases for use with npm. When package.json
defines a “main” alias the file can keep its original path for relative
requires, but the package name can be aliased to it.
e.g. node_modules/moment/moment.js is referenced relatively by
modules within the moment npm module. So it must keep
moment/moment.js as its path. But it should also be able to be
required using just moment.
By using aliases for more than just components we can support requiring files with their full extension so that a JavaScript file and a template can have the same name with different extensions.
This also sets up main aliases for use with npm. When package.json defines a “main” alias the file can keep its original path for relative requires, but the package name can be aliased to it.
e.g.
node_modules/moment/moment.js
is referenced relatively by modules within the moment npm module. So it must keepmoment/moment.js
as its path. But it should also be able to be required using justmoment
.This is just a rebased version of #12