diff --git a/packages/@angular/cli/commands/serve.ts b/packages/@angular/cli/commands/serve.ts index 1550ff0d644e..384f6ef0542a 100644 --- a/packages/@angular/cli/commands/serve.ts +++ b/packages/@angular/cli/commands/serve.ts @@ -135,11 +135,8 @@ const ServeCommand = Command.extend({ commandOptions.vendorChunk = !commandOptions.buildOptimizer; } - // Default evalSourcemaps to true when sourcemaps are true. - // This makes rebuilds faster. - if (commandOptions.sourcemaps === true) { - commandOptions.evalSourcemaps = true; - } + // Default evalSourcemaps to true for serve. This makes rebuilds faster. + commandOptions.evalSourcemaps = true; return checkPort(commandOptions.port, commandOptions.host, defaultPort) .then(port => { diff --git a/tests/e2e/tests/build/eval-sourcemap.ts b/tests/e2e/tests/build/eval-sourcemap.ts new file mode 100644 index 000000000000..0d3db0e06d8a --- /dev/null +++ b/tests/e2e/tests/build/eval-sourcemap.ts @@ -0,0 +1,24 @@ +import {execAndWaitForOutputToMatch, killAllProcesses} from '../../utils/process'; +import {getGlobalVariable} from '../../utils/env'; + + +export default function() { + // Skip this in ejected tests. + if (getGlobalVariable('argv').eject) { + return Promise.resolve(); + } + + return Promise.resolve() + // Check that ng serve has eval sourcemaps by default. + .then(() => execAndWaitForOutputToMatch('ng', ['serve'], /webpack: Compiled successfully/)) + .then((output) => { + const stdout = output.stdout; + if (/\.js\.map/.test(stdout)) { + throw new Error('Expected eval sourcemap but file sourcemap was present instead.'); + } + }) + .then(() => killAllProcesses(), (err: any) => { + killAllProcesses(); + throw err; + }); +}