简体   繁体   中英

How to get anonymous function library running with webpack

I'm trying to get this module: https://github.com/marcj/css-element-queries embedded in a ReactJS app that I have.

Unfortunately if I run:

import {ElementQueries,ResizeSensor} from 'css-element-queries';

at the top of my app, nothing happens. Any ideas?

Update

To clarify what I mean. The library doesn't appear to get triggered when the browser loads as it's supposed to. However if I load the console and type ElementQueries.init(); it works.

If I put that in the React component though I get the following error:

_cssElementQueries.ElementQueries.init is not a function

have you tried: import 'css-element-queries';

And then access ElementQueries or ResizeSensor as a global?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM