Skip to content

importing is cumbersome for deeply nested components, how do I set up a map to the app root? #865

Description

@NullVoxPopuli
$ ng --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.2-mobile.3
node: 5.10.1
os: linux x64

how do I set up a mapping for my app root to import?
I'm trying to avoid doing:

import { stuff } from '../../../../../../../components/some/path-to/what/iwant

and would like to do:

import { stuff } from 'myAppName/components/some/path-to/what/iwant

it is more intuitive, to specify an app-relative path, especially when refactoring (so you don't need to open the file tree, and count how many ../ you have...

I've tried adding mappings in my system-config.ts, but I haven't found anything to work.

constmap: any={'@app': 'src'};

doesn't work -- as in:

import { stuff } from '@app/components/mystuff' 

errors on build.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions