Closed dfilatov closed 1 year ago
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.
@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.
@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.
@timocov Now it works great, thank you!
Error:
createNode is not a function