Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

Custom Watch Task on Node Module Changes

$
0
0

@sean-perkins wrote:

I have a custom watch config used to listen for an npm linked module that will have changes persist when you make changes to the main folder.

watch.config.js

var watch = require('@ionic/app-scripts/dist/watch');
var copy = require('@ionic/app-scripts/dist/copy');
var copyConfig = require('./copy.config');

// this is a custom dictionary to make it easy to extend/override
// provide a name for an entry, it can be anything such as 'srcFiles' or 'copyConfig'
// then provide an object with the paths, options, and callback fields populated per the Chokidar docs
// https://www.npmjs.com/package/chokidar

module.exports = {
    srcFiles: {
        paths: [
            '{{SRC}}/**/*.(ts|html|s(c|a)ss)',
        ],
        options: {
            ignored: [
                '{{SRC}}/**/*.spec.ts',
                '{{SRC}}/**/*.e2e.ts',
                '**/*.DS_Store',
                '{{SRC}}/index.html'
            ]
        },
        callback: watch.buildUpdate
    },
    libFiles: {
        paths: [
            '{{ROOT}}/node_modules/@nx-ionic/**/*.(ts|html|s(c|a)ss)'
        ],
        callback: watch.buildUpdate
    },
    copyConfig: copy.copyConfigToWatchConfig()
};

I have also added the watch script to the correct config section of the package.json:

  "config": {
      "ionic_watch": "config/watch.config.js",
      "ionic_copy": "config/copy.config.js",
      "ionic_webpack": "config/webpack.config.js"
  },

The issue that I am facing is that when I make changes to the linked module, the watch does in fact fire and it says the app is building, but the main.js never actually rebuilds and always reflects the old changes.

If I make changes inside the ionic app, the app will rebuild with those changes, but will never take any new changes from node_modules, unless I completely re-serve the app.

On the latest of everything and using ionic-app-scripts.

Has anyone faced this issue, know where or how to accomplish what I need? I’ve dug through the build scripts and tried altering them to always form a full build, but that gridlocks the process. I’ve also looked at modifying the webpack config, but there does not seem to be any publicly documented configurations for external packages.

Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>