Ant-design-pro: [2.0] How do you import relative less files?

Created on 2 Nov 2018  ·  5Comments  ·  Source: ant-design/ant-design-pro

Versions:

    "umi": "^2.0.1",
    "umi-plugin-react": "^1.0.1"

I've looked at #2346 and #2432 and #2306 and it still doesn't work.

I'm importing from:

app/src/components/Foo/Bar/index.less

I'm trying to import:

app/src/variables.less

I've tried:

@import '../../../variables.less';
@import '/variables.less';
@import '/src/variables.less';
@import '~/variables.less';
@import '~variables.less';
@import '~@/variables.less';
@import '[email protected]';

I also tried to change the varFile in https://github.com/ant-design/ant-design-pro/blob/master/config/plugin.config.js to the ../src/variables.less and that didn't work either.

Nothing works.
How do I fix this?

Most helpful comment

Then why do we use plugin.config.js file. Let's remove it permanently.

All 5 comments

sorry,this is my error.
you can remove plugin.config.js

Seriously? I can just delete the plugin.config.js file?
It won't break the build or anything? 😕

and need remove chainWebpack: webpackPlugin,

Then why do we use plugin.config.js file. Let's remove it permanently.

@import '~@/
Ended up working for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yaoleiroyal picture yaoleiroyal  ·  3Comments

952425340 picture 952425340  ·  3Comments

yjz1004 picture yjz1004  ·  3Comments

gaoqiang19514 picture gaoqiang19514  ·  3Comments

Jerry-goodboy picture Jerry-goodboy  ·  3Comments