search

Home  >  Q&A  >  body text

javascript - Weird. require('stylus') in .vue file fails

I want to use stylus

in the <script> of the .vue file
let stylus = require('stylus')
console.log(stylus)

but failed.

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

I created a new test.js file and there is no problem in quoting it in it.

I tried setting this in webpack.base.conf.js:

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

Useless.

Has anyone experienced this pitfall or have any ideas?

grateful

大家讲道理大家讲道理2812 days ago712

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-06-12 09:25:07

    stylus cannot run on the browser and cannot be referenced.

    reply
    0
  • Cancelreply