Skip to content

Commit

Permalink
Merge pull request #18 from Jahia/BACKLOG-22737-watch-fix-platform
Browse files Browse the repository at this point in the history
Add a platform check to run a platform specific sleep command in watch mode
  • Loading branch information
TimRobertDev authored Aug 19, 2024
2 parents a5e7028 + a0f0fb7 commit 0814e5b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module.exports = (env, mode) => {
react: 'jsServerCoreLibraryBuilder.getSharedLibrary(\'react\')',
'react-i18next': 'jsServerCoreLibraryBuilder.getSharedLibrary(\'react-i18next\')',
i18next: 'jsServerCoreLibraryBuilder.getSharedLibrary(\'i18next\')',
'styled-jsx/style': 'jsServerCoreLibraryBuilder.getSharedLibrary(\'styled-jsx\')',
'styled-jsx/style': 'jsServerCoreLibraryBuilder.getSharedLibrary(\'styled-jsx\')'
},
resolve: {
mainFields: ['module', 'main'],
Expand Down Expand Up @@ -139,10 +139,13 @@ module.exports = (env, mode) => {
// Also an additional sleep is added to avoid watch triggering too much in a short time
// (Feel free to adjust the sleep time according to your needs)
if (mode.watch) {
// Sleep time in seconds, can be adjusted
const sleepTime = 5;

configs.push({
name: 'watch',
mode: 'development',
dependencies: ['client', 'server'], // wait for all webpack configs to be done
dependencies: ['client', 'server'], // Wait for all webpack configs to be done
entry: {},
output: {},
plugins: [
Expand All @@ -168,13 +171,13 @@ module.exports = (env, mode) => {
scripts: [
'yarn jahia-pack',
'yarn jahia-deploy',
'sleep 5', // sleep for 5 seconds, can be adjusted
process.platform === 'win32' ? 'timeout ' + sleepTime : 'sleep ' + sleepTime
],
blocking: true,
parallel: false
}
})
],
]
});
}

Expand Down

0 comments on commit 0814e5b

Please sign in to comment.