Tuesday, October 4, 2016

Migrating to Ionic 2 RC 0 - Custom Config Files

I followed the documentation about Custom Config Files. For this, I copied the rollup.config.js from node_modules/@ionic/app-scripts/config into my own config directory. Then I changed my package.json according to the documentation:
"config": {
  "ionic_rollup": "./config/rollup.config.js"
},
But now the build reported:
Config file "/Users/.../config/rollup.config.js" not found. Using defaults instead.
Error: Cannot find module '../dist/plugins/ng-template'
As every developer, I tried to solve the first message. But the config file was at exact the reported place. Finally, after checking the code, I found it just "misleading". The problem ist the second message. The first line of the copied rollup.config.js was
var ngTemplate = require('../dist/plugins/ng-template').ngTemplate;
Since I moved the file, the relative path didn't work any more. There for I changed the first line to
var ngTemplate = require('../node_modules/@ionic/app-scripts/dist/plugins/ng-template').ngTemplate;
And both error messages were history.

Update 9-Oct-2016: Latest with @ionic/app-scripts@0.0.30, ngTemplate is no longer required by rollup. Therefore the mentioned error does not occur anymore.

No comments:

Post a Comment