Ant-design-pro: npm start 报错 Cannot find module '@/utils/utils.less'

Created on 20 Sep 2018  ·  13Comments  ·  Source: ant-design/ant-design-pro

npm start 后总是报 Cannot find module '@/utils/utils.less' 这个错误
dkaq 3 l ugx5rh4y5w0

Most helpful comment

Try: @import '~@/
It worked for me.

Useless

All 13 comments

我也是碰到同样的问题,有没有人来解答一下?

@willsame 我解决了 引用的路径要用单引号包裹,不能用双引号

用单引号能解决问题,但是这个问题很诡异,还要在看看。好像是别名和 less-loader 一起用会有问题。外面用双引号来引的话 webpack 会在识别别名的时候带上不必要的单引号。

@caesar-cat @yutingzhao1991 果然单引号可以,感谢感谢

@caesar-cat @yutingzhao1991 但是有个很奇怪的问题,我修改为单引号过后,git commit 提交本地的话,它有自动改回去了,变为双引号了,知道什么原因么?

@yutingzhao1991 @sorrycc 和 prettier 冲突了,
有没有什么更好的办法

@chenshuai2144 能否解释一下,为什么要用单引号。。

Try: @import '~@/
It worked for me.

Try: @import '~@/
It worked for me.

Useless

Useless too.

我也遇到该问题,且还没解决

@willsame 我解决了 引用的路径要用单引号包裹,不能用双引号
亲测,无效

用相对路径吧,别名已经不支持的

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Yoping picture Yoping  ·  3Comments

zhongjiewu picture zhongjiewu  ·  3Comments

cheung1111 picture cheung1111  ·  3Comments

2uncle-code picture 2uncle-code  ·  3Comments

yadongxie150 picture yadongxie150  ·  3Comments