As I am running out of time to solve this, I’m taking the shorter path now. I think I got it working with symlinks as follows:
- Moved out an exemplary shared module to some shared folder
- Created a symlink (windows, admin CMD required): cd …\src\modules && mklink /D shared …\ …\ …\ …\SharedModules\shared (hint: be aware that the forum modifies the target path somehow strangely)
- Add ./config/watch.config.js:
const watchConfig = require('@ionic/app-scripts/config/watch.config');
// add symlinked paths manually to enforce them being watched - even though they are in src/ folder they will otherwise be ignored
module.exports = watchConfig;
- Add ./config/webpack.config.js:
const webpackConfig = require('@ionic/app-scripts/config/webpack.config');
// When using symlinks for modules this must be set to FALSE, otherwise compile issues will be shown
// yes this sounds counter intuitive...
webpackConfig.dev.resolve.symlinks = false;
webpackConfig.prod.resolve.symlinks = false;
module.exports = webpackConfig;
- Add to package.json to use our new config files
This seems to work, including ionic serve, live reload and production build.
If somebody else has some spare time and can go on with my results to investigate better options, I would be glad…
All I need now is some kind of setup script which initializes the symlinks after checkout on all platforms.
edit: does somebody know a cross-platform solution for adding symlinks, e.g. via npm “postinstall” script which does not require admin privileges on windows?