Module resolver for Aurelia packages

I am trying to get to a point where I can use the standard ES6 module scripts and load Aurelia. This means no webpack and no systemjs / JSPM.

The import from nodejs is fine but Aurelia does not offer a use case where it uses relative paths in it’s internal package resolve.

for example:

import { PLATFORM } from ‘aurelia-pal’;

The typical error message I run into is:
Uncaught TypeError: Failed to resolve module specifier “aurelia-framework”. Relative references must start with either “/”, “./”, or “…/”.

What in theory would work here is to have the native-modules dist but that references internal requirements with relative paths.

I tried to trap these calls in a service worker so that I can manually determine the paths, but alas it I can’t find a way to let the browser ignore the check it tries to do.

Since I don’t know what the effort would be to update these paths (if possible) to instead use relative paths, I would love to hear if you guys have any ideas on how to best overcome this?

The idea here is to get as close to native browser with as little package dependencies possible.

Are there any examples of initializing and using Aurelia with just using “< script type=“module”> ?”

You can use a prebundled aurelia, the same one that gistrun uses. There soon will be an aurelia bundler for help do custom build all aurelia modules into a single esm file or umd file

2 Likes

Sounds promising. Where is the prebundled aurelia stored ?, it does not seem to be part of the framework dist folder.

    <script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
    <script src="https://jdanyow.github.io/rjs-bundle/config.js"></script>
    <script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script>
    <script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script>
    <script>
      require(['aurelia-bootstrapper']);
    </script>