CLI + Minify config override

#1

I can’t seem to get any minify config overrides for the CLI to work. If I’m reading everything correctly the following should work, but is not.

aurelia.json

"minify": {
    "dev": false,
    "prod": {
        "keep_classnames": true
    }
}
1 Like

#2

What bundler are you using?
I think webpack disrepects most of the aurelia.json configs.

1 Like

#3

Base CLI Typescript/RequireJs

1 Like

#4

The keep_classnames options is correctly passed to terser to minify the bundle file.

The reason for that not working is there is not any class left after TypeScript compiling.

For example, TS compiled app.ts to something like this

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var App = (function () {
    function App() {
        this.message = 'Hello World!';
    }
    return App;
}());
exports.App = App;

The App is not using class syntax anymore, it’s a function. Two possible solutions.

  1. use "keep_fnames": true
  • Tested, it works.
  1. or, adjust tsconfig.json compileOptions.target to newer JS standard.
1 Like