奇怪。 require('stylus') in .vue file 失败

我想在.vue文件的<script>中是用stylus

let stylus = require('stylus')
console.log(stylus)

但是失败了。

This dependency was not found:
* fs in ./~/.0.54.5@stylus/lib/utils.js, ./~/.0.54.5@stylus/lib/middleware.js and 12 others
To install it, you can run: npm install --save fs
This relative module was not found:
* ./lib-cov/stylus in ./~/.0.54.5@stylus/index.js

我新建了个test.js文件,在里面引用却没问题。

我试过在webpack.base.conf.js 中设置这个:

{
            test: /\.styl$/,
            loader: 'style-loader!css-loader!stylus-loader'
        }
        

没用。

有人有踩过这个坑或者任何想法吗?

感谢

阅读 3.6k
1 个回答

stylus 无法运行在浏览器上,不能引用。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题