Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
feat(@angular-devkit/core): add support for source map in templates
Browse files Browse the repository at this point in the history
Using the source-map library from mozilla. Its pretty neat.
  • Loading branch information
hansl committed Sep 25, 2017
1 parent ef0d69c commit 7636d7f
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 268 deletions.
12 changes: 9 additions & 3 deletions lib/bootstrap-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,15 @@ require.extensions['.ts'] = function (m, filename) {
require.extensions['.ejs'] = function (m, filename) {
const source = fs.readFileSync(filename).toString();
const template = require('@angular-devkit/core').template;
const result = template(source, { sourceURL: filename, sourceMap: true });

return m._compile(result.source.replace(/return/, 'module.exports.default = '), filename);
const result = template(source, {
sourceURL: filename,
sourceMap: true,
module: true,
sourceRoot: process.cwd(),
fileName: filename.replace(/\.ejs$/, '.js'),
});

return m._compile(result.source, filename);
};


Expand Down
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function() {
<%throw new Error();
<%
const required = (schema.required || []);
const extras = {
exceptions: exceptions,
Expand Down

0 comments on commit 7636d7f

Please sign in to comment.