Skip to content

Import fails from node_modules when the module name is same as resolve alias #481

@yogeshgadge

Description

@yogeshgadge

Somewhere in my code I use

import 'mdl-selectfield';

for which I have create a resolve alias as below:-

    resolve: {
        root: [
            path.resolve('./app/'),
            path.resolve('./node_modules/')
        ],
        alias : {
            "inputmaskDir": path.resolve('./node_modules/jquery.inputmask/dist/inputmask'),
            "mdl-selectfield": path.resolve('./node_modules/mdl-selectfield/dist/mdl-selectfield.js')
        },
        extensions: [ '', '.json', '.js', '.min.js', '.bundle.js', '.css', '.min.css', '.scss', '.html' ]
    },

then somewhere down the line in my styles.scss I use some import as below:-

@import "~mdl-selectfield/src/selectfield/selectfield";

This results into module not reachable error for the SCSS import.

If I change the alias to something other than the module name then it works fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions