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

Generate a jsconfig or tsconfig with paths set #55

Open
jho406 opened this issue May 3, 2024 · 0 comments
Open

Generate a jsconfig or tsconfig with paths set #55

jho406 opened this issue May 3, 2024 · 0 comments

Comments

@jho406
Copy link
Collaborator

jho406 commented May 3, 2024

When running rails superglue:install:web or rails generate scaffold post body:string --force --no-template-engine --superglue superglue_rails generates page components with import statements that uses relative links. For example, in application.js we import page components like ../../views/posts/index.js.

Adding a jsonconfig.json or a tsconfig.json would help to shorten those imports. For example:

{
  "compilerOptions": {
    "target": "ES2016",
    "module": "ESNext",
    "moduleResolution": "Bundler", // << you should enable this
    "esModuleInterop": true,
    "paths": {
      "@/*": ["./app/javascript/*"]
    }
  },
  "exclude": ["node_modules/**/*"]

Since this file is generated once, add it as part of the rails superglue:install:web run.

@jho406 jho406 changed the title Generate a jsconfig.json Generate a jsconfig or tsconfig with paths set Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

1 participant