Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Using relative paths - sources still contains absolute paths #70

Description

@jsonUK
  • Operating System: OSX 10.14.4
  • Node Version: v11.12.0
  • NPM Version: 6.7.0
  • webpack Version: 4.28.4
  • cache-loader Version: 2.0.1

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

...,{"version":3,"sources":["/Users/jason/Sites/...

Code

module.exports = (env, argv) => {

    return {
        mode: argv.mode,
        ...
        module: {
            rules: [
                {
                    {
                        test: /\.m?js?$/,
                        exclude: /(node_modules|bower_components)/,
                        use: [{
                            loader: 'cache-loader',
                            options: {
                                cacheContext: path.normalize(path.relative(__dirname, '.')),
                                cacheDirectory: 'cache/'
                        }, {
                            loader: 'babel-loader'
                        }]
                    }
                }
            ]
        }
    }
}

How Do We Reproduce?

Happens in both modes development and production.

Command been using: webpack --mode production

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions