Open jbnv opened 7 years ago
It could be related to #21 #25, it seems depending on how you are consuming it there could be problems, the "core" logic in this plugin is sound, and has been since inception, almost all issues that plague it are down to the tooling around consuming modules so I have said in previous issues I don't have the capacity currently to fix it as the package.json main is hooked up to the right file so it should just work.
Hopefully someone can do a PR who knows the current tooling and approaches for Aurelia and then everyone can be happy until the next tooling change occurs :(
One other thing to mention is that you should load these plugins up as a plugin
not a feature
which some people use as a hack around, you may also need to consult the CLI docs to see if you need to add any custom properties to your package.json to imply what should be bundled.
I'm at my day job right now and the project is a personal project, so I can't look into it further at the moment but will do so later. I am pretty sure that I am loading it as a plugin
, but I will double-check.
I set my aurelia.json per hozn's post in #25. Now my code compiles and runs at the command line, but throws undefined 'exports'
on the first line of the code block below. Is this one of the variations of aurelia-chart
?
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configure = configure;
var _observersModelObserver = require("./observers/model-observer");
function configure(aurelia) {
aurelia.globalResources("./elements/chart-element", "./attributes/chart-attribute");
aurelia.container.registerTransient(_observersModelObserver.ModelObserver);
}
Changed the code in aurelia.json
to this:
{
"name": "chart.js",
"path": "../node_modules/chart.js/dist",
"main": "Chart.min"
},
{
"name": "aurelia-chart",
"path": "../node_modules/aurelia-chart/dist/amd",
"main": "index"
},
Now I'm getting the h.load
error when I include .plugin('aurelia-chart')
.
Do they still have a plugins skeleton app? as it may be worth someone just grabbing that, putting these files in there and building off that, as so far 99% of the problems I receive are just trying to load the plugin in, there is rarely a problem once the plugin has been successfully loaded.
Yes. You can generate one with the new Aurelia CLI.
I created a shell application with the modifications and uploaded it to GitHub. The first commit is the unmodified shell application; the second commit are the changes that trigger the bug.
is it the package.json changes or the aurelia.json changes which primarily cause it? or is it just when both are there?
With this aurelia.json
config
{
"name": "chart.js",
"path": "../node_modules/chart.js/dist",
"main": "Chart.min"
},
{
"name": "aurelia-chart",
"path": "../node_modules/aurelia-chart/dist/amd",
"main": "index",
"resources": [
"elements/chart-element.js",
"elements/chart-element.html",
"attributes/chart-attribute.js"
]
},
The aurelia-cli can run the app, but the console outputs two errors:
Uncaught Error: Mismatched anonymous define() module: function (exports, _aureliaFramework, _observersModelObserver, _chartJs)
Each one is caused respectively by elements/chart-element.js
and attributes/chart-attribute.js
(aka if i dont load these resources, i don't get the error but i can't use the package...)
This is highly related to jbnv's comment
Getting this error as I attempt to start up my application from the CLI:
Aurelia is trying to find
observers/model-observer.js
in the application's rootsrc
directory, not the one foraurelia-chart
. I added bothaurelia-chart
andchart.js
through NPM. How can I resolve this problem?