systemjs / builder

SystemJS build tool
MIT License
465 stars 122 forks source link

How to renormalize sources in sourcemaps when building #822

Open CxRes opened 7 years ago

CxRes commented 7 years ago

This is probably a support request but it may be a feature request

I have a program structure like this:

project
|-- package.json
|-- src
     |-- config.js
     |-- jspm_packages
     |-- bootstrap.js

I am doing a build like this:

builder.bundle('bootstrap.js', 'des/output.js', { minify:true, sourceMaps:true })

All the sources in the generated sourceMap start as ..\src\*. I would like to normalize these paths to get rid of ..\src portion, because des/ becomes its own independent package for distribution (I copy package.json and modify main; this is in a nwjs env). For example, Uglify offers the base option for sourceMaps. I cannot see an equivalent option here (I have tinkered with baseURL to no avail)??

guybedford commented 7 years ago

Maybe try building the application within the baseURL itself?

CxRes commented 7 years ago

The trouble with that is (it was the first idea I had as well) that I cannot replace bootstrap.js with itself. If I use another name, then I have to rewrite my index.html to modifying the script tag to point to this new name. Right now I can copy the index.html from src to des. If I rename and copy this file instead, the reference in the map file has a different name, which means I have to rewrite that then Also, it just feels wrong to build files in the src folder...