0
votes

I am having trouble creating my first Aurelia plugin. When testing it out in a new, clean Aurelia CLI project, TypeError: undefined is not an object (evaluating 'target.__useDefault') is displayed in the browser error console.

When calling ensureOriginOnExports(executed, name) in vendor-bundle.js, executed is undefined.

Here's the steps I used:

  1. Downloaded the zip from github.

  2. Unzipped and renamed the folder to aurelia-plugin-test.

  3. Followed the directions on the skeleton github page.

  4. Changed the name in package.json to aurelia-plugin-test.

  5. Re-ran gulp build.

  6. Published to npm: npm publish ./.

  7. Created a brand new Aureali CLI project.

  8. Installed the plugin: npm install aurelia-plugin-test --save.

  9. Added the following in aurelia.json:

    { "name": "aurelia-plugin-test", "path": "../node_modules/aurelia-plugin-test/dist/amd", "main": "aurelia-plugin-test" }

  10. Added aurelia.use.plugin('aurelia-plugin-test'); into the configure function in main.js.

  11. Ran au run and got the error when loading my plugin.

So I'm just using the skeleton without any code changes. So it just contains the hello-world custom element.

1
Did you figure this one out? I'm having the same issue. - Brian
I have not. I ended up not using a plugin. - Jeff G

1 Answers

0
votes

In your aurelia.json add the following "resources" to the bundle config:

{ 
   "name": "aurelia-plugin-test", 
   "path": "../node_modules/aurelia-plugin-test/dist/amd", 
   "main": "aurelia-plugin-test",
   "resources": [
      "hello-world.js",
      "hello-world.html"
   ] 
}