Ionic 2: gulp + webpack? and relative url?

Hi guys

I worked with ionic one until now and I have some question about ionic 2.

I have started with creating a blank project with the --ts flag and i have few questions:

  1. I have notice that there is gulp + wepack, Why both of them are needed? I saw that all gulp is doing is just moving the files from the app folder to www. Cant wepack do that?

  2. I have notice that in the app/pages/home/home.ts the templateUrl to the html file is locate at the build folder… I excepted the path to be ./home.html, I know this like that since the the location is relative to the app.bundle file but that seems odd, when creating more and more pages it will be harder to guess where the file is going be relative to the app.bundle, how can i use relative paths to the .ts file itself?

  3. When running ionic serve nothing happen… i must run sudo ionic serve for the app to start :. thats weird no?
    I used sudo npm install -g ionic@beta… (i cant install that without sudo, permission denied)

Thanks ahead

Hey there!

  1. So we’re planning to move off of webpack for the default starts soon, but we still want to provide a way for people to change the build process. So if people wanted to use webpack or rollup, they could and still have things work. It would just get called from the gulpfile.

  2. So these urls aren’t relative to the .ts files, but to the index.html. Similar to Ionic/Angular 1, where in our state definitions, paths were relative to the index.html

  3. Correct, windows does not have sudo. So you should be able to do

npm install -g ionic@beta

from an elevated command prompt (window’s version of sudo)

Im working with linux. So how can i avoid this sudo before serve?

Just use chown -r for your project directory and ionic directory, that changes the root owner permission to you permission.

You should be able to run

sudo chown -R $(whoami) ~/path/to/project

To own the project again.