Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Generate correct sourceMapUrl #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/builders/JSBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {MaterialToolsOutput} from './MaterialBuilder';

const fse = require('fs-extra');
const uglify = require('uglify-js');
const path = require('path');

export class JSBuilder {
/**
Expand All @@ -13,6 +14,10 @@ export class JSBuilder {
let mainModule = this._buildMainModule(data.dependencies._mainModule);
let raw = data.files.js.map(path => fse.readFileSync(path).toString()).join('\n');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path here now causes a lint error:

ERROR: /home/travis/build/angular/material-tools/lib/builders/JSBuilder.ts[15, 33]: Shadowed name: 'path'

Can you please rename this path variable to file?

let source = [mainModule, '', raw].join('\n');

// Create source map filename from given minified filename
filename = path.basename(filename).replace(/\.min\.js/, '.map')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing a lint error:

ERROR: /home/travis/build/angular/material-tools/lib/builders/JSBuilder.ts[19, 68]: Missing semicolon


let compressed = uglify.minify(source, {
fromString: true,
outSourceMap: filename,
Expand Down