nguyenvanduocit / vue-cli-plugin-style-resources-loader

Vue cli plugin to support style-resources-loader.
58 stars 7 forks source link

How To Import npm Dependencies? #12

Closed smhmd closed 5 years ago

smhmd commented 5 years ago

In a vue component to import an npm dependency in stylus you write: @import '~open-color/open-color.styl' this is very literal and I don't know how to import open-color directly without specifying the path (for example I don't know how to import nib in vue components) but my question is how to import anything npm

const path = require('path');
module.exports = {
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'stylus',
        patterns: [
          path.resolve(__dirname, '~open-color/open-color.styl')
        ],
      },
    },
};

doesn't work

nguyenvanduocit commented 5 years ago

patterns simply an absolute path, so you can try:

path.resolve(__dirname, '.node_modules/open-color/open-color.styl')