store: UglifyJS breaking ngxs?

I used to build my app for prod with ng build --app=default -oh=media --prod but the ngxs store is not working with prod builds with this command, ngxs works without issues in dev modeng s -e mock --extract-css --preserve-symlinks --proxy-config proxy.conf.js

After trying various -prod mode options, I am thinking UglifyJS is causing this issue.

unfranaltiy angular-cli doesn’t have option to desable UglifyJS with -prod builds. As a workaround, I am using following command to emulate prod builds.
ng build --app=default -oh=media -e prod --aot=true --build-optimizer=true --named-chunks=false --sourcemaps=false (this cannot add service-worker unfraunalty)

wonder if anyone experiencing this issue when building for prod with angular-cli!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 29 (20 by maintainers)

Most upvoted comments

@rbsloot - added to docs 😃

If you want to let the product build work for @Action as well, you will need to add a static readonly type = 'ActionClassName' to the action class implementation.

Example:

export class YourActionClass {
    static readonly type = 'YourActionClass';

    constructor(payload: any) {}
}

If you do not add the static type variable your @Action decorators might not work when mangled by UglifyJS.


Could somebody add this to the Action documentation, because there is no mention of this type property there

@xmlking No prob. @deebloo Tricky one. I only saw it because I had a similar issue at work with trying to use class names to set default css classes on components