-
-
Notifications
You must be signed in to change notification settings - Fork 51
Using relative paths - sources still contains absolute paths #70
Comments
Please use issue template otherwise issue was closed, thanks |
Updated previous post with new template as requested. |
@jsonUK could please verify if the absolute paths you have are coming from source-maps? Maybe we can just disable and delete the cache to understand if the new generated cache still have absolute paths. If the problem is from source-maps, you can configure webpack to only have relative paths within the sourcemaps: const path = require('path')
const context = // absolute context path
module.exports = {
context,
// ...
output: {
devtoolModuleFilenameTemplate: (info) => {
const rel = path.relative(context, info.absoluteResourcePath);
return `webpack:///${rel}`;
},
// ...
}
} Do you have any other idea here @evilebottnawi ? |
Hi - sorry for not getting back sooner. I had a test of what you sent me - the above snippet made no difference to the cache output. But I noticed that if I disable Not sure if cache-loader should be accommodating that output? Would toggling on/off source-map data between eg.
Ideally the paths would not be absolute in the source-map data, when setting a context path - but I lack the knowledge to know if that would affect other tools from working etc. |
I wrote a loader to convert all abs paths to relative but i would use it as a last result because it will increase the build time... https://github.com/stavalfi/babel-plugin-module-resolver-loader |
Hi,
I know the relative paths has been a fairly recent feature addition (thank you!)... but I noticed that the cache contents still contain absolute paths.
This sets the correct relative paths in the cache details, but then I see things like this inside the cache file, under the
"results":[...]
object:Expected Behaviour
...,{"version":3,"sources":["src/js/...
Is it possible to parse these "sources" as relative paths too - so that they context stays the same?
This is for javascript files running through
uglifyjs-webpack-plugin
(not sure if that is relevant or not).Actual Behaviour
Code
How Do We Reproduce?
Happens in both modes
development
andproduction
.Command been using:
webpack --mode production
The text was updated successfully, but these errors were encountered: