Skip to content
This repository was archived by the owner on Sep 11, 2018. It is now read-only.

Unable to create absolute path or alias on import. #52

Closed
bori87 opened this issue Sep 13, 2017 · 2 comments
Closed

Unable to create absolute path or alias on import. #52

bori87 opened this issue Sep 13, 2017 · 2 comments

Comments

@bori87
Copy link

bori87 commented Sep 13, 2017

I am trying to set up an alias for my common module directory.
I want
import { RouterModule } from '~app/common';
instead of
import { RouterModule } from '../common';
How can i achieve this? I have tried to add alias in webpack.config.js but compiler is looking for module relative to "app/tns_modules/".
emu

@sean-perkins
Copy link

The tilde on an import will signify importing a module from node_modules, not your app directory. You should be able to create a webpack alias and import from app/common, assuming you have an index.ts in that file location.

Take a peak at this issue for more information: angular/angular-cli#5031

Let me know if that help resolves your question.

@donburgess
Copy link
Contributor

Currently the tsconfig we have for ~ is set to recognize ~/ in webpack. Perhaps this should not include the / though?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants