Using in both 'dev' and 'build' modes
See original GitHub issueI’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:
- Created 3 years ago
- Comments:7
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Makes sense. Thank you!
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 myyarn start
command starting my dev server and just add someENV
variable, then check it’s existence in my code and omitmodule-alias/register
then it should work indev
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.