Skip to content

Commit 4c8c53c

Browse files
committed
Fix bad paths in source map generation
1 parent c2f72f2 commit 4c8c53c

File tree

1 file changed

+2
-33
lines changed

1 file changed

+2
-33
lines changed

Gruntfile.js

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,6 @@ module.exports = function(grunt) {
169169
uglify: {
170170
options: {
171171
sourceMap: true,
172-
sourceMapName: function (dest) {
173-
return path.join(path.dirname(dest),
174-
path.basename(dest, '.js')) +
175-
'.map';
176-
},
177172

178173
// Only preserve comments that start with (!)
179174
preserveComments: /^!/,
@@ -191,10 +186,6 @@ module.exports = function(grunt) {
191186
}
192187
},
193188

194-
fixSourceMaps: {
195-
all: ['build/**/*.map']
196-
},
197-
198189
eslint: {
199190
target: ['Gruntfile.js', 'src/**/*.js', 'plugins/**/*.js']
200191
},
@@ -316,28 +307,6 @@ module.exports = function(grunt) {
316307
grunt.config.set('pkg', pkg);
317308
});
318309

319-
grunt.registerMultiTask('fixSourceMaps', function () {
320-
this.files.forEach(function (f) {
321-
f.src.filter(function (filepath) {
322-
if (!grunt.file.exists(filepath)) {
323-
grunt.log.warn('Source file "' + filepath + '" not found.');
324-
return false;
325-
} else {
326-
return true;
327-
}
328-
}).forEach(function (filepath) {
329-
var base = path.dirname(filepath);
330-
var sMap = grunt.file.readJSON(filepath);
331-
sMap.file = path.relative(base, sMap.file);
332-
sMap.sources = _.map(sMap.sources, path.relative.bind(path, base));
333-
334-
grunt.file.write(filepath, JSON.stringify(sMap));
335-
// Print a success message.
336-
grunt.log.writeln('File "' + filepath + '" fixed.');
337-
});
338-
});
339-
});
340-
341310
// Grunt contrib tasks
342311
grunt.loadNpmTasks('grunt-contrib-uglify');
343312
grunt.loadNpmTasks('grunt-contrib-clean');
@@ -358,8 +327,8 @@ module.exports = function(grunt) {
358327
grunt.registerTask('browserify.core', ['_prep', 'browserify:core'].concat(browserifyPluginTaskNames));
359328
grunt.registerTask('browserify.plugins-combined', ['_prep', 'browserify:plugins-combined']);
360329
grunt.registerTask('build.test', ['_prep', 'browserify:test']);
361-
grunt.registerTask('build.core', ['browserify.core', 'uglify', 'fixSourceMaps', 'sri:dist']);
362-
grunt.registerTask('build.plugins-combined', ['browserify.plugins-combined', 'uglify', 'fixSourceMaps', 'sri:dist', 'sri:build']);
330+
grunt.registerTask('build.core', ['browserify.core', 'uglify', 'sri:dist']);
331+
grunt.registerTask('build.plugins-combined', ['browserify.plugins-combined', 'uglify', 'sri:dist', 'sri:build']);
363332
grunt.registerTask('build', ['build.plugins-combined']);
364333
grunt.registerTask('dist', ['build.core', 'copy:dist']);
365334

0 commit comments

Comments
 (0)