Foundation-sites: Expose vendor JS from webpack

Created on 23 Feb 2018  路  3Comments  路  Source: foundation/foundation-sites

I'm trying to use a third party JS file to add Feather Icons [ Git Repository ] to my site. If I just add the JS separately I'm able to use the icons. However, when I add them to the webpack bundle

import { feather } from 'feather-icons';

and try to call the function with feather.replace()';

I get the following error

Uncaught ReferenceError: feather is not defined

I see the JS added to bundle, but I can't seem to access it. Any ideas on how to do this?

question

Most helpful comment

Hi @CGTS

See the Feather main file. There is no feather exported.

Please use:

import { icons } from 'feather-icons';

Also to see what their in in a package, you can use:

import * as library from 'feather-icons';

console.log(library);

All 3 comments

Hi @CGTS

See the Feather main file. There is no feather exported.

Please use:

import { icons } from 'feather-icons';

Also to see what their in in a package, you can use:

import * as library from 'feather-icons';

console.log(library);

That was it. Thank you.

Thank you for this! After two year still useful!

Was this page helpful?
0 / 5 - 0 ratings