Foundation-sites: 从webpack公开供应商JS

创建于 2018-02-23  ·  3评论  ·  资料来源: foundation/foundation-sites

我正在尝试使用第三方JS文件将Feather Icons [ Git Repository ]添加到我的网站。 如果我只是单独添加JS,则可以使用图标。 但是,当我将它们添加到webpack捆绑包中时

import { feather } from 'feather-icons';

并尝试使用feather.replace()';调用该函数

我收到以下错误

Uncaught ReferenceError: feather is not defined

我看到JS已添加到捆绑包中,但似乎无法访问它。 有关如何执行此操作的任何想法?

question

最有用的评论

@CGTS

请参阅Feather主文件。 没有导出feather

请用:

import { icons } from 'feather-icons';

还可以查看它们在包装中的内容,可以使用:

import * as library from 'feather-icons';

console.log(library);

所有3条评论

@CGTS

请参阅Feather主文件。 没有导出feather

请用:

import { icons } from 'feather-icons';

还可以查看它们在包装中的内容,可以使用:

import * as library from 'feather-icons';

console.log(library);

就是这样谢谢。

这次真是万分感谢! 两年后仍然有用!

此页面是否有帮助?
0 / 5 - 0 等级