WebPack: Include Non-Bundle Files In Watch-List to Trigger Rebuild
That is, point to files (somewhere) that are not to be included in any final bundles, but do trigger a rebuild of the aforementioned bundles.
Sidenote:
I have already:- Googled around using a few search terms
- Looked at Webpack's
watchOptions-- even triedinclude&includedfor"./path/to/target/file.json"&/\.\/path\/to\/target\/file\.json/(just for kicks) - Skimmed through Webpack Plugins for anything with "Watch", "Trigger" & "Change"
No luck :(
Here is [generally] what I am looking for:
~/webpack.config.jsmodule.exports = {
entry: modules, // <-- COMES FROM `./app.json`
output: {
filename: '[name].bundle.[hash].js',
path: path.resolve(__dirname, './dist'),
},
...
watchOptions: {
include: './app.json', // <-- NOT INCLUDED IN BUNDLE (contains `modules` at key `entry`)
},
};
~/app.json
{
"environments": {
"production": { THESE NEED TO BE WATCHED!!!
... |
}, |
"development": { |
... |
} |
}, |
"modules": { V
"x.component": [ "./src/.../x.component.ts", "./src/.../x.component.scss" ],
...
},
...
}
OR
webpack-dev-server --watch ./app.json
Question
How can I watch non-bundle files and trigger a rebuild?