Production build issue

I’m having a very strange issue…in my production build if I exclude devtool or set it to false, or use the default value from aurelia-cli, there seems to be some side effects-after selecting a dropdown in the examples page, required views are not rendering properly.

The only thing that works for me so far is to use the development value for (see commit) devtool for production. The fix is deployed here.

To test this issue locally, I have http-server installed. After npm run build I open a cli in dist folder and running http-server and I get the same result as I do when deployed.

Has anyone experienced this or have suggestions?

1 Like

I resolved this, some of my plugins custom elements were missing @customElement(name) and aurelia wasn’t able to find the element after webpack’s production mode minification & obfuscation.

2 Likes

Arr, nice to hear that. So i guess you use static resources registration API? If so, yes webpack may have issues. Also in the original post, there was no error message and also you mentioned aurelia cli, i thought you used our built in bundler.

Note to self: document the issue of static api with webpack… while documenting the api itself.

I didn’t see any errors before, the aujsf-slot element wasn’t running lifecycle hooks so I just happened to look at it and notice it didn’t have the decorator. I’m not sure if I am using static resources registration api, is that FrameworkConfiguration.globalResources?

1 Like

dynamic resources:

configuration.globalResources([
  'resource-module-1',
  'resource-module-2',
])

static resources:

configuration.globalResources([
  MyResourceConstructor1,
  MyResourceConstructor2,
])

static as in statically analysable or no need to load a module by its name first, and look into it.

ahh yes I am using static resources then, good to know. I don’t recall where I read this, but it was recommended to use the decorator when writing plugins instead of relying on convention so I did use it in most places, just a few were missed. thanks for the help as always :slight_smile:

1 Like