【发布时间】:2017-06-09 15:39:22
【问题描述】:
我尝试在test.vue 文件中使用手写笔
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 文件,并在其中添加了require('stylus'),没关系。
太奇怪了。
"vue": "^2.3.3",
"stylus": "^0.54.5",
任何帮助将不胜感激,谢谢。
【问题讨论】:
-
尝试在 webpack 配置文件中添加 node: { fs: 'empty' }。
-
@qkr 我在webpack.base.conf.js中添加了,但是不行。
-
如果你想在
.vue文件中使用stylus,你需要webpack的loader,它叫做stylus-loader -
@BelminBedak 我使用
npm install stylus-loader并在 webpack.base.conf.js 中添加{test: /\.styl$/,loader: 'style-loader!css-loader!stylus-loader'}。还是不行。 -
我认为您不必在 webpack 文件中明确将其作为规则包含在内 - 只需在
style文件的style部分添加lang="stylus"属性即可。
标签: vue.js require vue-component stylus