I have set up a custom webpack configuration for Ionic 3 in order to use src
as a path alias (meaning I can import from src/module/file
):
resolve: {
alias: {
'src': path.resolve('./src')
}
}
However, after updating to Ionic app scripts @ 3, I encountered an error stating
Cannot find module src/module/file
when trying to serve or build.
I have come across methods for creating path aliases to import from directories within src
(such as app
, pages
, etc.) that involve modifying the Webpack resolve alias and updating the baseUrl in tsconfig.json
. For instance:
https://medium.com/@siddhartha.ng/ionic-3-import-using-aliases-2aa260d6fab3
Nevertheless, my goal is to be able to import directly from src
rather than a subdirectory of src
. Is there a way to achieve this by adjusting my webpack or TypeScript configuration?