superglue
superglue copied to clipboard
Generate a jsconfig or tsconfig with paths set
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.