Skip to content

Missing [path] in module.less files [webpack 4] #165

Open
@wbern

Description

@wbern

my.module.less in chrome devtools
Before webpack 4.1.1

var escape = require("../../../node_modules/css-loader/lib/url/escape.js");
exports = module.exports = require("../../../node_modules/css-loader/lib/css-base.js")(true);
// imports


// module
exports.push([module.id, ".app-controllers-___header-module__header___...snip

// exports
exports.locals = {
	"header": "app-controllers-___header-module__header___2cDAd",
	"link": "app-controllers-___header-module__link___9ZF3f",
	"title": "app-controllers-___header-module__title___3zdsk",
	"versionName": "app-controllers-___header-module__versionName___P3mUm",
	"loggedInUser": "app-controllers-___header-module__loggedInUser___2g4NC",
	"settingsAndInfo": "app-controllers-___header-module__settingsAndInfo___3tMjw",
	"usernameLabel": "app-controllers-___header-module__usernameLabel___12VlL",
	"userOptionsList": "app-controllers-___header-module__userOptionsList___392Md",
	"userOptionsListItem": "app-controllers-___header-module__userOptionsListItem___1axLL",
	"readonlyLabel": "app-controllers-___header-module__readonlyLabel___3TM1g",
	"outdatedStyle": "app-controllers-___header-module__outdatedStyle___1Hj_P",
	"outdatedLink": "app-controllers-___header-module__outdatedLink___3w-ME"
};

After webpack 4.1.1:

var escape = require("../../../node_modules/css-loader/lib/url/escape.js");
exports = module.exports = require("../../../node_modules/css-loader/lib/css-base.js")(true);
// imports


// module
exports.push([module.id, ".___header-module__header_...snip
// exports
exports.locals = {
	"header": "___header-module__header___2hFEv",
	"link": "___header-module__link___3788-",
	"title": "___header-module__title___1ltkk",
	"versionName": "___header-module__versionName___PiO_N",
	"loggedInUser": "___header-module__loggedInUser___3rJB5",
	"settingsAndInfo": "___header-module__settingsAndInfo___3En63",
	"usernameLabel": "___header-module__usernameLabel___2IGNx",
	"userOptionsList": "___header-module__userOptionsList___NyxVd",
	"userOptionsListItem": "___header-module__userOptionsListItem___3U7ZZ",
	"readonlyLabel": "___header-module__readonlyLabel___1XVj-",
	"outdatedStyle": "___header-module__outdatedStyle___2aBI2",
	"outdatedLink": "___header-module__outdatedLink___3RjtB"
};

My rule:

{
    test: /\.module\.less$/,
    use: [
        {
            loader: "style-loader",
            options: { sourceMap: true }
        },
        {
            loader: "css-loader",
            options: {
                sourceMap: true,
                modules: true,
                importLoaders: 1,
                localIdentName: "[path]___[name]__[local]___[hash:base64:5]"
            }
        },
        {
            loader: "postcss-loader",
            options: {
                sourceMap: true,
                plugins: loader => [
                    require("postcss-import")({
                        root: loader.resourcePath
                    }),
                    require("postcss-cssnext")({
                        warnForDuplicates: false
                    }),
                    require("postcss-csso")({
                        zindex: false
                    })
                ]
            }
            // publicPath: ""
        },
        {
            loader: "less-loader",
            options: { sourceMap: true }
        }
    ]
};

I'm guessing here that [path] is the item missing in the output.
Any thoughts? Is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions