question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using in both 'dev' and 'build' modes

See original GitHub issue

I’ve just installed module-alias and it works great with my TypeScript app using path aliases after I build the app.

tsconfig.json:

    "baseUrl": "./src",
    "paths": {
      "@src/*": ["./*"],
      "@utils/*": ["utils/*"]
    }

package.json

  "_moduleAliases": {
    "@src": "dist",
    "@utils": "dist/utils"
  },

However now dev mode the app is not working, it seems like module-alias completely takes over the path alias resolutions and even in dev mode the app tries to pull .js files from dist (instead of using .ts from src).

For development I use ts-node-dev:

ts-node-dev --respawn --no-notify -r tsconfig-paths/register ./src/index.ts

Am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
jazzfogcommented, Aug 7, 2020

Makes sense. Thank you!

1reaction
jazzfogcommented, Aug 4, 2020

Thanks @Kehrlann, I will give it a shot. Thought I see that it will require customization to the command I use to start the app, if it is the case and I can’t just run node dist/index.js then I could just probably customize my yarn start command starting my dev server and just add some ENV variable, then check it’s existence in my code and omit module-alias/register then it should work in dev as well. It is even kinda better because it does not restrict you in the way you start the final build, if it makes sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flutter's build modes
The Flutter tooling supports three modes when compiling your app, and a headless mode for testing. You choose a compilation mode depending on...
Read more >
How Does the Development Mode Work? - Overreacted
Bundling and running different code in development and production is powerful. In development mode, React includes many warnings that help ...
Read more >
Build in dev mode for Angular 12 - Stack Overflow
I've just added a development section under build/configurations ... and I run the app with ng serve myapp --configuration development.
Read more >
Mode | webpack
NODE_ENV on DefinePlugin to value development . Enables useful names for modules and chunks. production, Sets process.env.NODE_ENV on DefinePlugin ...
Read more >
Build and run your app - Android Developers
By default, new projects are set up with two build variants: a debug variant and release variant. You need to build the release...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found