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

Doesn't work with typescript 5 #25

Closed
dfilatov opened this issue Apr 3, 2023 · 4 comments
Closed

Doesn't work with typescript 5 #25

dfilatov opened this issue Apr 3, 2023 · 4 comments

Comments

@dfilatov
Copy link

dfilatov commented Apr 3, 2023

Error: createNode is not a function

@timocov
Copy link
Owner

timocov commented Apr 4, 2023

Have you considered to use https://github.com/timocov/ts-transformer-properties-rename instead? I recently upgraded it to support typescript 5 and it is able to do exactly the same as this transformer does (and even more), so I'm curious what could be a reason not to use it. Will wait for your feedback.

@dfilatov
Copy link
Author

@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.

@timocov
Copy link
Owner

timocov commented Apr 23, 2023

@dfilatov thanks for detailed explanation, I appreciate it! I've updated this transformer to make it work with the latest typescript version in https://github.com/timocov/ts-transformer-minify-privates/releases/tag/v1.0.0 release and unblock your work. Meanwhile I'll use your feedback to improve https://github.com/timocov/ts-transformer-properties-rename and make transition from to it smoother.

@dfilatov
Copy link
Author

@timocov Now it works great, thank you!

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