Skip to content

@import problem #33

Open
Open
@dmeij

Description

@dmeij

Hi I have the following problem with @import. I have the following directory structure:

  • src
    • globals
      • Default.less
    • modules
      • dashboard
        • View.js
        • View.less
      • help
        • View.js
        • View.less

In every View.js I import the View.less, so far so good. The Views.less files look like this:

globals/Default.less
@color_black: #424242;

dashboard/View.less

@import "src/globals/Default.less";

.module {color: @color_black;}

help/View.less

@import "src/modules/dashboard/View.less";

.module {font-size: 14px;}

When I try to run this code it breaks: "TypeError: Path must be a string. Received { resolve: [Function: resolve]". It looks like the first time you import a less file the relative path is the root directory of my project. But when I import the next file "dashboard/View.less" the relative path in that file isn't the root directory anymore, but the directory it is imported from "src/modules/help/". I've tried using ./ or / in "dashboard/View.less" for the Default.less import.

I hope that i've described my problem clear enough en hope you can help me with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions