javascript - Source map created points to system paths instead of relative path -


i using uglifyjs2 minify javascript source files 1 large minified file. here relevant bit of code use:

var options = options || {}; options.outsourcemap = 'minfile.js.map';  try {     // "scripts" array of absolute paths javascript files     var minified = uglifyjs.minify(scripts, options);      // minified.map contains minfile } catch (err) {     // handle errs here } 

the minfile contains absolute paths source files:

{     "version": 3,     "file": "nodebb.min.js.map",     "sources": [         "/path/to/folder/jquery/js/jquery.js",         "/path/to/folder/another/lib.js",         ...     ],     ... } 

the problem is, source files i'm passing in not accessible publically, compiled minfile , minfile accessible. therefore, source map seems pointless, chrome (in case) tries load http://mydomain.com/path/to/folder/jquery/js/jquery.js instead of reading file on local fs.

what doing wrong?

looks uglifyjs2 repo missing bunch of options node api, pr fixed bit: https://github.com/mishoo/uglifyjs2/pull/192

so i'm using in package.json now:

"dependencies": {     ...     "uglify-js": "git+https://github.com/julianlam/uglifyjs2.git",     ... } 

then prefix can passed minify method lop off parts of path aren't needed.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -