<style lang="stylus">
//使用相对路径可以正确导入
@import '../assets/css/index.styl';
//使用 @路径引入 报错
@import '@/assets/css/index.styl'; </style>
解决方案
@import '~@/assets /css/index.styl'
原理:CSS loader 会把把非根路径的url解释为相对路径, 加~前缀才会解释成模块路径。
<style lang="stylus">
//使用相对路径可以正确导入
@import '../assets/css/index.styl';
//使用 @路径引入 报错
@import '@/assets/css/index.styl'; </style>
解决方案
@import '~@/assets /css/index.styl'
原理:CSS loader 会把把非根路径的url解释为相对路径, 加~前缀才会解释成模块路径。