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

Improve the import routes #111

Closed
gabrielmdc opened this issue Sep 18, 2019 · 1 comment
Closed

Improve the import routes #111

gabrielmdc opened this issue Sep 18, 2019 · 1 comment
Assignees
Labels
enhancement branch name: features/[major|minor]/branch-description

Comments

@gabrielmdc
Copy link
Owner

Example of tsconfig.json (paths field)

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"],
      "@repositories" : ["repositories"],
      "@repositories/*" : ["repositories/*"],
      "@services/*" : ["services/*"],
      "@models/*" : ["models/*"],
      "@validation/*" : ["validation/*"],
      "@routes/*" : ["routes/*"],
      "@plugins/*" : ["plugins/*"],
      "@config" : ["config"]
    }
  },
  "exclude": ["node_modules", "tests/bdd"]
}
@gabrielmdc gabrielmdc added the enhancement branch name: features/[major|minor]/branch-description label Sep 18, 2019
@gabrielmdc gabrielmdc self-assigned this Sep 18, 2019
@gabrielmdc
Copy link
Owner Author

When the code is transpiled to JS, the JS files keep the same reference, something like: 'import whatever from '@foo', and obiously, the symbol @ for imports, does not make sense from a JS file.

More about this:

The recommendation right now is to use a package like module-alias or something like Webpack.

I try to keep the project as simple as possible and I do not want to use something like Webpack, this project is too simple for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement branch name: features/[major|minor]/branch-description
Projects
None yet
Development

No branches or pull requests

1 participant