I have an Angular project (with a few lines of AssemblyScript) and i'm trying to make the WASM compilation and copy the compiled files into the assets folder juste before Angular re-builds the project when we make some changes.
I've tried to make use of the "Custom webpack builders" but even when i try to use the "BeforeCompile" hook from webpack, angular re-builds and re-builds... I think it's because it take X miliseconds to copy the files into the angular assets folder, and then it detects changes, then it rebuilds...
Do you have some idea?
Here's my custom webpack code:
const { exec } = require("child_process");
module.exports = {
watchOptions: {
ignored: /node_modules/,
},
plugins: [
{
apply: (compiler) => {
compiler.hooks.beforeCompile.tap('MyPlugin', () => {
exec('npm run asbuild', (err, stdout, stderr) => {
console.error('stderr', stderr);
console.warn('stdout', stdout);
});
});
},
}
]
};