1

我想在我的 Vue 项目中使用 nanoid。我都试过了:

import nanoid from 'nanoid';
import { nanoid } from 'nanoid';

但是 webpack 失败了

Module Error (from ./node_modules/eslint-loader/index.js):
error: Missing file extension "cjs" for "nanoid" (import/extensions) at src\components\molecules\ProfileLink.vue:18:24:
  16 | import { BPopover } from 'bootstrap-vue';
  17 | // import nanoid from 'nanoid';
> 18 | import { nanoid } from 'nanoid';

添加后缀也无济于事:

This dependency was not found

如何解决?

4

0 回答 0