Electron-webpack not watching files for symlinked angular library

Viewed 157

I recently added an Angular library to my Angular project. I compile and symlink the lib into my node_modules folder for the main project.

Unfortunately, the compiled code is not triggering a rebuild of the main project.

I've tried many thing:

  1. Watch options:

    watchOptions: {
          ignored: [
              // Ignore all node_modules, except my_module
              /node_modules([\\]+|\/)+(?!my_module)/,
              /my_module([\\]+|\/)node_modules/,
          ],
     },
    
  2. monkeypatch watchpack

  3. "preserveSymlinks": true in angular.json

  4. Tried filewatcher-webpack-plugin:

    new filewatcherPlugin({
           watchFileRegex: [
              require.resolve('my_module')
           ]
    }),
    

    Result: When lib compiled, changes are detected and webpack crashes with "ConcurrentCompilationError: You ran Webpack twice."

  5. Tried webpack-watch-files-plugin

    new WatchExternalFilesPlugin({
         files: [
             './dist/my_module/bundles/my_module.umd.js'
         ],
         verbose: true
    })
    

    Result: Correctly logs "Additional files watched: [file path]", but does not trigger compilation when the symlinked library is compiled.

  6. Tried extra-watch-webpack-plugin

    new ExtraWatchWebpackPlugin({
        files: [
           './node_modules/uikit/fesm2015/mymodule.js'
        ]
    }),
    

I'm running out of ideas here.

0 Answers
Related