I updated to iOnic 3 and also to the New Ionic CLI v3.
Because the documentation about the new version is not the best, I can’t find out how to generate components, pages or providers.
I hope somebody can help me
I found a workaround to generate my providers without errors.
I just type ionic generate
, select provider, give it a name and then select Use this provider in more than one template?
with Yes
JAR19
April 7, 2017, 4:00pm
2
Just type in the command ionic generate
I tried:
ionic generate page test
Got error:
Error: The generate command is only available for projects that use ionic-angular >= 3.0.0
package.json contains:
"ionic-angular": "3.0.0-beta.3"
What stops you updating to 3.0.1?
Nothing - now that I know it is available.
So, you are saying that 3.0.0 does Not work but 3.0.1 does?
I can generate pages when I just type ionic generate
Then this page shows up
? What would you like to generate: (Use arrow keys)
❯ component
directive
page
pipe
provider
tabs
No problems when I want to generate a page or component. But I can’t generate any provider without errors. I select for example my login page and then this error shows up
TypeError: Cannot read property 'initializer' of undefined
at Object.appendNgModuleDeclaration (/Users/daniel/Documents/Projekte/Cinematica/node_modules/@ionic/app-scripts/dist/util/typescript-utils.js:212:38)
at /Users/daniel/Documents/Projekte/Cinematica/node_modules/@ionic/app-scripts/dist/generators/util.js:161:46
I updated to 3.0.1 and using ionic generate works. It provides options for page, provider etc, as LoLStats noted.
Provider Did work for me though. No errors. I chose use in multiple components.
It automatically injected it into my app.module.ts.
Using 3.0.0-beta.3 did not work.
When a page is generated, it is creating the module.ts but is using the following, which throws an error:
IonicModule.forChild(TestPage),
Chaning it to this fixes it:
IonicPageModule.forChild(TestPage),
I assume this is because of something else I have not updated. Maybe @ionic /app-scripts which I have currently at 1.2.5
How does one find out which is the current package dependencies and devDependencies to update to?
It is not mentioned for 3.0.1 in the changelog:
<a name="3.9.2"></a>
## [3.9.2](https://github.com/ionic-team/ionic/compare/v3.9.1...v3.9.2) (2017-11-08)
## Upgrade Instructions
`ionic-angular` 3.9.2 is patch release of `ionic-angular` 3.9.1. To upgrade, follow the instructions [here](https://github.com/ionic-team/ionic/blob/master/CHANGELOG.md#390-2017-11-08) for updating to `ionic-angular` 3.9.0. After completing those steps, update the `ionic-angular` version to 3.9.2.
```
npm install ionic-angular@3.9.2 --save
```
### Bug Fixes
* **action-sheet:** remove ios inertia scroll to fix flicker ([c463b06](https://github.com/ionic-team/ionic/commit/c463b06)), closes [#13262](https://github.com/ionic-team/ionic/issues/13262)
<a name="3.9.1"></a>
## [3.9.1](https://github.com/ionic-team/ionic/compare/v3.9.0...v3.9.1) (2017-11-08)
## Upgrade Instructions
This file has been truncated. show original
Also, concerning the provider generated, while it did include it in the app.module.ts, on windows, it is wrong.
I created a provider called MapService which gives me this runtime error:
Cannot find module "..providersmap-service/map-service"
The genrated line in the app.module was:
import { MapServiceProvider } from '..\providers\map-service/map-service';
However, this works ( slashes):
import { MapServiceProvider } from '../providers/map-service/map-service';
Frankly, I would avoid the generators.