jsverse / transloco-keys-manager

🦄 The Key to a Better Translation Experience
https://github.com/jsverse/transloco/
MIT License
203 stars 49 forks source link

Bug: Unable to import TranslocoExtractKeysWebpackPlugin #201

Open krechtern opened 3 months ago

krechtern commented 3 months ago

Is there an existing issue for this?

Is this a regression?

Yes

Current behavior

It's currently not possible to import the TranslocoExtractKeysWebpackPlugin from '@jsverse/transloco-keys-manager'.

This was working before switching from "@ngneat/transloco-keys-manager": "3.8.0" to "@jsverse/transloco-keys-manager": "5.1.0"

Bildschirmfoto 2024-08-14 um 10 09 50

Expected behavior

I expect that this import should still work, as it was working before and is still part of the README.md.

Please provide a link to a minimal reproduction of the bug

https://codesandbox.io/p/sandbox/jsverse-transloco-forked-kn72mv?file=%2Fwebpack-dev.config.ts%3A6%2C1

Transloco Config

No response

Debug Logs

No response

Please provide the environment you discovered this bug in

Transloco: 7.4.3
Transloco Keys Manager: 5.1.0
Angular: 17.3.11
Node: 20.15.1
Package Manager: npm
OS: macOS

Additional context

No response

I would like to make a pull request for this bug

No

krechtern commented 1 month ago

Does nobody have the same issue? Am I doing something wrong here?

krechtern commented 1 month ago

I did some investigation and could resolve the above error with changing my moduleResolution from node to bundler (wasn't really aware that node means node10).

But I still wasn't able to use the plugin. We are using nx and @angular-builders/custom-webpack:dev-server to setup the plugin. We ended up with receiving a no 'exports' main defined error. This probably happened because we haven't set type: "module" in our package.json so our custom webpack config file was treated as cjs module. After setting our project to type: "module" we received a lot of errors regarding no existing pollyfills for multiple node packages.

At that point I stopped working on this problem, because it takes too much time. I removed the plugin for now, so we are at least finally able to use the new scope and the new transloco versions.

shaharkazaz commented 1 month ago

@krechtern Hey! yes, the package is now ESM, we can also provide a cjs version to allow the import. Would you like to open a PR for it? 🙂