Having a custom rollup.config breaks the watcher

I have a custom rollup.config which works fine the first time i do ‘ionic serve’ but doesn’t after I make changes for the first time and the watcher kicks in.

Note that i have a customized src folder named ‘app’.

I put in some console.logs in the ionic scripts to find out what’s going on. So far I can tell that after each watch trigger the destination path is appended to the previous one, which obviously leads to a wrong path.

Here’s the console output:

The custom rollup config i use looks like this:

var ngTemplate = require('../node_modules/@ionic/app-scripts/dist/plugins/ng-template').ngTemplate;
var nodeResolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');

    module.exports = {
        sourceMap: true,
        format: 'iife',
        plugins: [
                directoryMaps: {
                    '.tmp': 'app'
                module: true,
                jsnext: true,
                main: true,
                browser: true,
                extensions: ['.js']


and the config value in package.json looks like this:

"config": {
    "ionic_src_dir": "app",
    "ionic_sass": "configs/sass.config.js",
    "ionic_copy": "configs/copy.config.js",
    "ionic_rollup": "configs/rollup.config.js"

So it seems things go wrong in bundle.js:runBundle

You get the config in util.fillConfigDefaults which requires the user config.
This config is then mutated in this line:
rollupConfig.dest = path.join(context.buildDir, rollupConfig.dest);

First time everything’s fine. Watcher kicks in though after a change, requires again in util.fillConfigDefaults, which returns the same instance and the path is mutated again on this instance. That’s why it keeps appending to the same path.

Things like that are a huge pain for us!

Github issue: https://github.com/driftyco/ionic-app-scripts/issues/59

My PR was merged, issue closed.