Closed dsasidhar closed 7 years ago
I've had this problem too.
Adding
"baseUrl": "src",
In tsconfig.json & tsconfig.webpack.json and restarting webpack solved it
@Zwimber I tried your solution and it didn't work, still getting the same error.
Changed it to baseurl "src". You can remove the config.resolve.modules.
Cannot find module 'app/app.component'.
Still the same error, no use. Do you have a working example of this, with the same setup?
I can't figure out why it would work for you and not for me.
@qdouble @Zwimber Any luck on this? Can't really figure out what is wrong, here.
@dsasidhar could you post the whole base code after you made change in a repo and paste the link here ? it would be easier to debug
and using dirname not dir seems to also work. but the whole code will help to debug if any other problem if any
@Rafi993 @Zwimber Please find https://github.com/dsasidhar/angular-webpack2-starter I tried your suggestions and couldn't get it to work.
This is solved by this SO question: https://stackoverflow.com/questions/46467827/absolute-path-doesnt-work-in-webpack-2
The baseUrl
had to be used in compilerOptions
that was the mistake all along.
I have tried adding support to absolute paths by changing the configuration in the webpack.config.ts: I made the following changes in
webpack.config.ts
:And in
webpack.d.ts
:I still get
Cannot find module
error when I try the import statment like this:import {AppComponent} from 'app/app.component':
I also tried using
path.resolve(__dir, 'src')
with no luck.Can someone please help? @qdouble Is this a known issue? I couldn't find any similar issue reported here.