Electron-vue: not support stylus

Created on 21 Jan 2019  路  5Comments  路  Source: SimulatedGREG/electron-vue

want i use stylus in App.vue

report error
./src/renderer/App.vue?vue&type=style&index=0&lang=stylus& (./node_modules/vue-loader/lib??vue-loader-options!./src/rende
rer/App.vue?vue&type=style&index=0&lang=stylus&) 30:3

Most helpful comment

I came across this issue and got it resolved by modifying my Webpack configs.

1. Get the loaders

Firstly, get both stylus-loader and stylus module installed.

2. Modify Webpack configs

Then, add the following rules in both webpack.web.config.js and webpack.renderer.config.js.

module: {
  rules: [
    {
      test: /\.styl(us)?$/,
      use: ['vue-style-loader', 'css-loader', 'stylus-loader']
    },
    ...
    {
      test: /\.vue$/,
      use: {
        loader: 'vue-loader',
        options: {
          loaders: {
            stylus: 'vue-style-loader!css-loader!stylus-loader',
            styl: 'vue-style-loader!css-loader!stylus-loader'
          }
        }
      }
    },
    ...
  ]
}

Hope it helps.

All 5 comments

i installed stylus and stylus-loader

Hello,
Did you made any change to your webpack config?

not change webpack config.

info

i meet the same problems although i install the stylus and stylus-loader . i try hard to change my webpack config,but it doesn't work.

I came across this issue and got it resolved by modifying my Webpack configs.

1. Get the loaders

Firstly, get both stylus-loader and stylus module installed.

2. Modify Webpack configs

Then, add the following rules in both webpack.web.config.js and webpack.renderer.config.js.

module: {
  rules: [
    {
      test: /\.styl(us)?$/,
      use: ['vue-style-loader', 'css-loader', 'stylus-loader']
    },
    ...
    {
      test: /\.vue$/,
      use: {
        loader: 'vue-loader',
        options: {
          loaders: {
            stylus: 'vue-style-loader!css-loader!stylus-loader',
            styl: 'vue-style-loader!css-loader!stylus-loader'
          }
        }
      }
    },
    ...
  ]
}

Hope it helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simonwjackson picture simonwjackson  路  3Comments

Oriol-GG picture Oriol-GG  路  3Comments

jt-wang picture jt-wang  路  3Comments

blackw212 picture blackw212  路  3Comments

xiaomizhou66 picture xiaomizhou66  路  3Comments