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

compile into source code instead of node modules #1607

Closed
3 of 4 tasks
Tracked by #1439
samuelstroschein opened this issue Nov 7, 2023 Discussed in #1579 · 2 comments · Fixed by #1609
Closed
3 of 4 tasks
Tracked by #1439

compile into source code instead of node modules #1607

samuelstroschein opened this issue Nov 7, 2023 Discussed in #1579 · 2 comments · Fixed by #1609
Assignees
Labels
scope: inlang/paraglide-js Related to source-code/sdk-js. type: improvement Something that can be improved. type: refactor Code being refactored to improved performance or long-term maintainability.

Comments

@samuelstroschein
Copy link
Member

samuelstroschein commented Nov 7, 2023

  • compile only JSDoc. get rid of typescript declaration stuff
  • remove namespacing stuff
  • init command must set "checkJs" "allowJs" to true
  • split messages to signal messages/de imports to everyone

Discussed in #1579

Originally posted by samuelstroschein November 2, 2023
Vote with 👍 or 👎

Problem

The majority/all JS tooling default assumes that code in node_modules is static. Paraglide's compilation into node_modules breaks that assumption, leading to bugs that are fixed with workarounds.

Proposal

Don't compile into node_modules. Instead, compile into the source code itself with a git ignore.

-import { setLanguageTag, languageTag } from '@inlang/paraglide-js/sveltekit-example';
+import { setLanguageTag, languageTag } from '../../paraglide-js/runtime';
-import * as m from "@inlang/paraglide-js/sveltekit-example/messages"
+import * as m from "../../paraglide-js/messages"

CleanShot 2023-11-02 at 16 34 46@2x

Pros

Neutral

  • users are responsible for importing messages themselves (no more explaining of 'namespaces' @inlang/paraglide-js/{name}/messages; imports will differ per user (but it's just normal JS after all!))

Cons

  • "pollution" of source code (gitignore to the rescue)
CleanShot.2023-11-02.at.16.37.28.mp4
@samuelstroschein samuelstroschein self-assigned this Nov 7, 2023
@maige-app maige-app bot added type: improvement Something that can be improved. scope: inlang/paraglide-js Related to source-code/sdk-js. labels Nov 7, 2023
@samuelstroschein samuelstroschein added the type: refactor Code being refactored to improved performance or long-term maintainability. label Nov 7, 2023
samuelstroschein added a commit that referenced this issue Nov 7, 2023
Redundant after compile into source code instead of node modules #1607
@DanikVitek
Copy link
Contributor

This way the dependency itself can be moved to the devDependencies section

@samuelstroschein
Copy link
Member Author

This way the dependency itself can be moved to the devDependencies section

correct!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: inlang/paraglide-js Related to source-code/sdk-js. type: improvement Something that can be improved. type: refactor Code being refactored to improved performance or long-term maintainability.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants