rollup-plugin-re
rollup-plugin-re copied to clipboard
Option to rerun provider fonction every rebuild
{
//...
watch: {
input: [
// ...
'./src/fileToInject.txt',
],
},
plugins: [
// ...
replace({
replaces: {
__PLACEHOLDER__: (data) => {
return fs.readFileSync('./src/fileToInject.txt', 'utf-8')
},
}
})
],
}
Expected result:
Everytime I modify fileToInject.txt
, I would like my bundle to be updated with the latest content.
Current result:
Currently the function is evaluated only once at the first build. When the watcher detects a change, the bundle is rebuilt, but the replace
plugin reuses the last value returned by the function. Therefore my bundle is not updated.
Solution:
Provide a evaluateEveryTime
or such option.