This repository has been archived by the owner on Aug 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(livesync): enable webpack with watch
Plug into NativeScript CLI's LiveSync pipeline in order to enable incremental webpacking with watch. Includes: * Instruct CLI to watch `App_Resources` directory only * Launch `webpack` with `--watch` on before-watch hook * Do not launch multiple `webpack` processes
- Loading branch information
Dimitar Kerezov
committed
Feb 7, 2018
1 parent
07ba1ae
commit d30bd90
Showing
9 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { runWebpackCompiler } = require("./compiler"); | ||
|
||
module.exports = function ($mobileHelper, $projectData, hookArgs) { | ||
if (hookArgs.config) { | ||
const appFilesUpdaterOptions = hookArgs.config.appFilesUpdaterOptions; | ||
if (appFilesUpdaterOptions.bundle) { | ||
const platforms = hookArgs.config.platforms; | ||
platforms.forEach(platform => { | ||
const env = hookArgs.config.env || {}; | ||
const config = { | ||
env, | ||
platform, | ||
bundle: appFilesUpdaterOptions.bundle, | ||
watch: true | ||
}; | ||
|
||
runWebpackCompiler(config, $mobileHelper, $projectData, hookArgs); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = function (hookArgs) { | ||
if (hookArgs.liveSyncData && hookArgs.liveSyncData.bundle) { | ||
const appDirectoryLocation = "app"; // Might need to get this from config file in the future | ||
const appResourcesDirectoryLocation = "app/App_Resources"; // Might need to get this from config file in the future | ||
return (args, originalMethod) => { | ||
return originalMethod().then(originalPatterns => { | ||
const appDirectoryLocationIndex = originalPatterns.indexOf(appDirectoryLocation); | ||
if (appDirectoryLocationIndex !== -1) { | ||
originalPatterns.splice(appDirectoryLocationIndex, 1); | ||
} | ||
|
||
if (originalPatterns.indexOf(appResourcesDirectoryLocation) === -1) { | ||
originalPatterns.push(appResourcesDirectoryLocation); | ||
} | ||
|
||
return originalPatterns; | ||
}); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters