Reputation: 119
Having trouble with using Framework7 with Aurelia. in aurelia.json I have the following:
{
"name": "Framework7",
"path": "../node_modules/framework7",
"main": "dist/js/framework7",
"exports": "Framework7"
}
In F7.js I have this code:
import Framework7 from "framework7";
export const F7 = new Framework7();
I get this error: commonJs.convert: COULD NOT CONVERT:services/f7.js, so skipping it. Error was: Error: Line 1: Unexpected token
I'm trying to follow https://github.com/Jenselme/tests-ionic2-and-aurelia-framework7/blob/master/aurelia-f7-todo/app/services/f7.js and also trying to look at the docs at Aurelia
I've also tried with import statement like this:
import "framework7"
Upvotes: 1
Views: 646
Reputation: 1067
Framework7 contains many resources like css and images which Aurelia can't process. You must manually bundle it.
Example with font-awesome library: How can I add Font Awesome to my Aurelia project using npm?
Upvotes: 1
Reputation: 10887
What about just loading Framework7 with a script tag? The Aurelia CLI uses RequireJS for module loading. I found this page that explains how to use Framework7 w/RequireJS and they use a script tag to load Framework7.
There's nothing wrong with using a script tag to load a legacy JS library that isn't module aware.
Additional comment:
Adding this script to the prepend
section of vendor-bundle
works as well.
Upvotes: 4