From ionic 1.2 to 2 - tips/best practices


#1

Hi there,
I have a rather important and critical project that is running very well on ionic 1.x.

I am about to start a new project and I thought its best I start learning Angular 2 and Ionic 2. However, reading the lists, it looks like i2 is not ready for production yet and a lot of plugins may not work.

So it is critical for me to make sure my build process, old plugins and old app continue to work as is. It seems to play with v2, I need grab a new version of ionic and the documentation states it should also work with old versions.

Can anyone confirm this is correct and upgrading to ionic2 won’t cause issues with v1 projects? thx


#2

The plugins are outside of Ionic itself. With that said, if you leveraged ngCordova as the interface to those plugins, you will need to migrate to Ionic Native.

Ionic 2 is getting much closer to RC status. With Angular reaching RC status, now might be the right time to start ramping up.

Your build process will change, Ionic 2 now uses webpack as part of its build process.

I think what you read was the CLI will still work with Ionic 1 projects, but Ionic 2 is almost a completely new and better framework.

Chris


#3

Thanks Chris. I think my wording was confusing. What I meant was:
a) I have an existing project that I have developed with v1 of ionic. That uses ng-cordova and various plugins. I have no plans to migrate any of that to v2.

b) I want to start a new project, not related to the above, to get started with learning angular/ionic2 and I understand the cli need to be upgraded for that

The question I have is if after upgrading the tool chain, will a) continue to work with ng-cordova, and old plugins, and old build process, for the old ionic v1 project.


#4

As we state in the docs:

Worried about your V1 Ionic projects? Don’t worry! The beta release has all the functionality to work with both V1 projects and V2 projects.

You’ll be able to switch back and forth without any problems.


#5

Thanks. Unfortunately, documentation for such things if often part fact and part hyperbole :slight_smile:
I upgraded, and as I feared, its not true that we will be able to compile and use v1 projects as is with no change.

I’m going to work though and resolve the errors, obviously, and the errors may be trivial to solve, so this is just FYI

[pp@pps-MacBook-Pro:~/winshare/pp/projects/phonegap/zmNinja]$ ionic build ios
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
There is an error in your gulpfile: 
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/Users/pp/winshare/pp/projects/phonegap/zmNinja/node_modules/node-sass/lib/index.js:22:11)
    at Object.<anonymous> (/Users/pp/winshare/pp/projects/phonegap/zmNinja/node_modules/node-sass/lib/index.js:188:23)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/pp/winshare/pp/projects/phonegap/zmNinja/node_modules/gulp-sass/index.js:3:17)
    at Module._compile (module.js:409:26)

#6

This just means that you’re node-sass version is out of date.

Try this

npm uninstall gulp-sass --save
npm install gulp-sass --save-dev

#7

yup - I fixed it. I was being partly pedantic and partly anal about working seamlessly :blush: