首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试从vuetify.js导入所选组件时找不到依赖项

尝试从vuetify.js导入所选组件时找不到依赖项
EN

Stack Overflow用户
提问于 2017-07-29 17:35:50
回答 1查看 1K关注 0票数 0

尝试从vuetify.js导入所选模块时,如下所示:

代码语言:javascript
复制
import Alerts               from 'vuetify/src/components/alerts';
import App                  from 'vuetify/src/components/app';
import Avatars              from 'vuetify/src/components/avatars';

webpack抛出了一个错误:

代码语言:javascript
复制
These dependencies were not found:
* ~util/helpers in ./node_modules/vuetify/src/components/avatars/index.js, ./node_modules/vuetify/src/components/cards/index.js and 14 others
* ~directives in ./node_modules/vuetify/src/components/lists/VListTile.js, ./node_modules/vuetify/src/components/menus/VMenu.js
* ~directives/click-outside in ./node_modules/vuetify/src/components/selects/VSelect.js
* ~directives/ripple in ./node_modules/vuetify/src/components/selection-controls/VCheckbox.js
* ~mixins/themeable in ./node_modules/vuetify/src/components/app/VApp.js, ./node_modules/vuetify/src/components/cards/VCard.js and 12 others
...
To install them, you can run: npm install --save ~util/helpers ~directives ~directives/click-outside ~directives/ripple ...

似乎vuetify.js在它的项目中使用了'~‘别名。

如何在我的项目中修复此问题,并能够使用第三方项目的单个组件?

我已经尝试为它们的来源设置'~‘别名:

代码语言:javascript
复制
    resolve: {
        alias: {'~': NODE_MODULES + '/vuetify/src'},
    },

但它并没有起作用。

EN

回答 1

Stack Overflow用户

发布于 2017-07-30 00:39:46

我已经通过添加以下配置解决了这个问题:

代码语言:javascript
复制
    resolve: {
        modules: ['./node_modules', './node_modules/vuetify/src'],
        alias: {
            '~': './app',
            '~components': 'components',
            '~directives': 'directives',
            '~mixins': 'mixins',
            '~stylus': 'stylus',
            '~util': 'util'
        },
    },
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45387716

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档