webpack (with sass-loader) - scss file @import does not recognize resolve alias

后端 未结 4 1588
慢半拍i
慢半拍i 2020-12-05 06:58

My project structure:

webpack.config.js
app--

   --> src
   ---->> components
   ------>>> myComponent.js
   ------>>> myComponen         


        
4条回答
  •  醉梦人生
    2020-12-05 07:17

    I was able to use, on a stylesheet, an alias that I defined in webpack by using the following:

    @import '~alias/variables';
    

    just by prefixing the alias with ~ did the trick for me, as suggested by documentation in here

提交回复
热议问题