-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): ensure live-reload shim workaroun…
…d isolation This change reduces the workaround to a single file location as well as ensuring that only the shims of interest from the two necessary live reload files are affected. This makes sure that build and serve behavior is the same in this regard.
- Loading branch information
Showing
3 changed files
with
56 additions
and
19 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
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,25 @@ | ||
import { prependToFile, writeFile } from '../../../utils/fs'; | ||
import { execAndWaitForOutputToMatch, killAllProcesses } from '../../../utils/process'; | ||
|
||
export default async function() { | ||
// Simulate a JS library using a Node.js specific module | ||
await writeFile('src/node-usage.js', `const path = require('path');\n`); | ||
await prependToFile('src/main.ts', `import './node-usage';\n`); | ||
|
||
try { | ||
// Make sure serve is consistent with build | ||
await execAndWaitForOutputToMatch( | ||
'ng', | ||
['build'], | ||
/Module not found: Error: Can't resolve 'path'/, | ||
); | ||
// The Node.js specific module should not be found | ||
await execAndWaitForOutputToMatch( | ||
'ng', | ||
['serve', '--port=0'], | ||
/Module not found: Error: Can't resolve 'path'/, | ||
); | ||
} finally { | ||
killAllProcesses(); | ||
} | ||
} |