Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How set up with angular? #26

Open
cesco69 opened this issue Jun 12, 2023 · 1 comment
Open

How set up with angular? #26

cesco69 opened this issue Jun 12, 2023 · 1 comment

Comments

@cesco69
Copy link

cesco69 commented Jun 12, 2023

I'm tried:

npm install ts-transformer-minify-privates --save-dev
npm install @angular-builders/custom-webpack  --save-dev
npm install ts-loader  --save-dev

angular.json

  "projects": {
      "architect": {
        "build": {
          "builder": "@angular-builders/custom-webpack:browser",
          "options": {
            "customWebpackConfig": {
              "path": "custom-webpack.config.js",
              "replaceDuplicatePlugins": true
            }
        }
    }
  }

custom-webpack.config.js

// webpack.config.js
var minifyPrivatesTransformer = require('ts-transformer-minify-privates').default;

module.exports = (config, options) => {
  if (config.module && config.module.rules) {
    config.module.rules.push(
      {
        test: /\.ts$/,
        loader: 'ts-loader', // or 'awesome-typescript-loader'
        options: {
          getCustomTransformers: program => ({
            before: [
              minifyPrivatesTransformer(program)
            ]
          })
        }
      }
    );
  }
  return config;
}

tsconfig.ts

"compilerOptions": {
    "plugins": [
      {
        "transform": "ts-transformer-minify-privates"
      }
    ]
}

RUN BUILD

npm run build

but private field aren't minified... :(

@cesco69 cesco69 changed the title How set up with angular How set up with angular? Jun 12, 2023
@timocov
Copy link
Owner

timocov commented Jun 27, 2023

Hi @cesco69, I'm not familiar with Angular. Does it give a way to provide custom transformers during the compilation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants