g.breeze
g.breeze

Reputation: 1967

How to use aurelia without module loaders?

I'd like to use aurelia in small mobile cordova apps. Is it possible to omit any module loaders like requirejs and use an aurelia bundle directly in a script tag like

  <script src="scripts/aurelia.js"></script>

?

Thanks, George

Upvotes: 6

Views: 529

Answers (2)

Tetious
Tetious

Reputation: 123

You can use JSPM to build a self executing bundle complete with system.js, and then you only need to include that one script. (no other dependencies are required)

Check out the docs on production workflows for JSPM for more details: https://github.com/jspm/jspm-cli/blob/master/docs/production-workflows.md#creating-a-self-executing-bundle

Upvotes: 2

Evan Larsen
Evan Larsen

Reputation: 9965

You could bundle your modules using requirejs' and then use almondjs to load your modules.

I know you said 'omit any module loaderes' but I don't think thats possible unless you wrote your own code to wire your modules together. They just wont work automagically. Your going to need some kind of module loader. Almondjs is a lightweight AMD module loader. It does not do any dynamic loading or fetching of modules. It's meant to only load modules which have already been bundled together.

So, what I have seen in the past is people would use requirejs during development but when they are releasing to production they would bundle their app using requirejs' bundler and then use almondjs in place of requirejs.

I was hoping someone else would answer this question because its been a long time since I've looked at almondjs. I'm wondering if there are any other solutions out there.

Upvotes: 1

Related Questions