Answer the question
In order to leave comments, you need to log in
How to connect modules in an AngularJs es6 project?
In general, I don’t know how to get rid of the “terrible” dependency names that you write yourself, in the sense that when you connect, you must specify the full path to them. Is there any way to remove this. Like for Node.js NODE_PATH. When he specified, for example, a mask of directories in which to search for source modules.
example:
import angular from 'angular'; //хорошо
import uirouter from 'angular-ui-router';
import services from './../blocks/services'; //выглядит не очень
import directives from './../blocks/directives';
import filters from './../blocks/filters';
import routing from './home.routes';
import HomeController from './home.controller';
export default angular.module('components.home', [uirouter, services, directives, filters])
.config(routing)
.controller('HomeController', HomeController)
.name;
Answer the question
In order to leave comments, you need to log in
You can specify aliases in SystemJS - this is convenient, at least for external libraries, so as not to write 'node_modules/angular/angular'
.
Of course! Because '../blocks/services'
.
To be honest, I don’t see a problem and I don’t advise changing anything. So in half a year you will begin to understand your own project, and there you will understand solid aliases and horseradish pross what comes from. And if you understand someone else's project, you won't be gray for long.
If you have really long paths like '../../../blocks/services/core/ui/old' then you need to refactor the project. " Flat is better than nested ."
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question