1

Hi i just finished installing asp.net core1 so got introduced to npm , bower and nodejs after researching a lot i chose to go with angular2 . now my problem is that i have never used gulp, grunt etc even though i know how it works and why to use it. there are lots of instructions on web to setup angular2 project with mvc6 but not explaining the thing which is new with mvc6.

anyways i dont want to get myself confused with gulp/grunt etc right now so i am just copying files from node_modules to my script folder and giving it path but it works almost for everything related to angular. for eg. import {anything} from 'angular2/core' or from RXjs etc(this import is from node_modules) and i have to give a path in my index files where i have copied all the files. but when i try to include some plugins like ng2-select, ng2-bootstrap or toastr etc it doesnt work the way it should it throws errors.

my question is do i need to copy whole folder from node_modules to my script folder and then linq it or what , how it works?

5
  • Have you tried doing the things that you are asking to see if it works? Commented Apr 5, 2016 at 12:24
  • yes i have and it doesnt for eg. i have dependencies in ng-bootstrap (moment and require) so i copied the whole ng2-bootstrap folder from node_modules to scripts , it shows errors at compiling time Commented Apr 5, 2016 at 13:58
  • then i built it inside node_module and referenced only single file ng2-bootstrp from script folder it throws error moment not found and etc Commented Apr 5, 2016 at 13:59
  • and those dependencies should i keep in respective node_module folder or should i install in my project Commented Apr 5, 2016 at 14:03
  • Perhaps you could post some of these errors you're getting in the question. At the moment it reads like I don't want to learn how things work properly so i'm trying it my own way and i'm getting errors and it's not working, please help. You're question is not clear and is probably the main reason no one is attempting to help you. Commented Apr 6, 2016 at 6:40

1 Answer 1

1

Do I need to copy whole folder from node_modules to my script folder and then link it or what, how does this work?

I have an example in my blog post of what you should be doing in this situation. Ideally, you will use a gulpfile.js to orchestrate your desired file needs. For example, if you're looking for Angular2 it is rather simple. You create a gulpfile.js by adding a new item to your project. In that file you write some simple "tasks" that automate this move for you. You look in node_modules and move over anything that you need. For Angular2 I move over the following .js files (in this example):

var angularJs = [
    './node_modules/angular2/bundles/angular2.js',
    './node_modules/angular2/bundles/router.js',
    './node_modules/angular2/bundles/angular2-polyfills.js',
    './node_modules/angular2/bundles/http.js'
];

So to answer your question more directly, no. You do not need to copy the entire folder -- just the files that your application needs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.