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

Improvde DX and migration from ts-transformer-minify-privates #33

Open
timocov opened this issue Apr 23, 2023 · 0 comments
Open

Improvde DX and migration from ts-transformer-minify-privates #33

timocov opened this issue Apr 23, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@timocov
Copy link
Owner

timocov commented Apr 23, 2023

@timocov I've tried to use https://github.com/timocov/ts-transformer-properties-rename but couldn't make it work.

How I use ts-transformer-minify-privates in webpack ts-loader:

import:

import minifyPrivatesTransformer from 'ts-transformer-minify-privates';

use in ts-loader rule:

    {
        loader: 'ts-loader',
        options: {
            transpileOnly,
            onlyCompileBundledFiles: true,
            compilerOptions: {
                target: `es${targetEsVersion}`,
                importHelpers: true,
                jsx: 'preserve',
                noUnusedLocals: false
            },
            getCustomTransformers: transpileOnly ?
                undefined :
                (program: ts.Program) => ({
                    before: [
                        minifyPrivatesTransformer(program)
                    ]
                })
        }
    }

How I try to use ts-transformer-properties-rename:

const propertiesRenameTransformer = require('ts-transformer-properties-rename').default;

First of all, It's weird ts-transformer-properties-rename doesn't include d.ts for types.
Then I replace transform with the new one. Now I have to pass some entrySourceFiles (with ts-transformer-minify-privates I don't).
Ok, I try to pass the same entry file as I pass to webpack entry:

propertiesRenameTransformer(program, { entrySourceFiles: [entryFile] })

And get an error:
Error: Cannot find source file /Users/dfilatov/prjs/arcadia/maps/front/services/nmaps/src/client/pages/app-page/nk-app-page.ts

But file /Users/dfilatov/prjs/arcadia/maps/front/services/nmaps/src/client/pages/app-page/nk-app-page.ts actually exists:

❯ ls -la /Users/dfilatov/prjs/arcadia/maps/front/services/nmaps/src/client/pages/app-page/nk-app-page.ts
-rw-rw-r--  1 dfilatov  LD\Domain Users  904 Mar  9  2022 /Users/dfilatov/prjs/arcadia/maps/front/services/nmaps/src/client/pages/app-page/nk-app-page.ts

Have no idea how to make it work. Please help.

Originally posted by @dfilatov in timocov/ts-transformer-minify-privates#25 (comment)

@timocov timocov added the enhancement New feature or request label Apr 23, 2023
@timocov timocov self-assigned this Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant