V
V
Vlad2021-03-10 15:14:01
JavaScript
Vlad, 2021-03-10 15:14:01

How to properly import a module so that Webpack likes it?

I found a suitable native JS feedback module , I can’t connect it, the documentation only says:

install with npm install flipdown or yarn add flipdown

What next:
For basic usage, FlipDown takes a unix timestamp (in seconds) as an argument.
new FlipDown(1538137672).start();


And how to do the import is not written.
The package.json of the module says "main": "src/flipdown.js"
There is no export in this file, so I just include:
either or Then I write
import 'flipdown';
require('flipdown');
new FlipDown(1618056000, {
    theme: 'dark'
}).start();

I get in the console:
Uncaught TypeError: _flipdown_js__WEBPACK_IMPORTED_MODULE_15___default.a is not a constructor

in debugger:
__webpack_require__(/*! flipdown */ "./node_modules/flipdown/src/flipdown.js");
new _flipdown_js__WEBPACK_IMPORTED_MODULE_15___default.a(1618056000).start(); // console.log(FlipDown);


If you connect in an old-school way, then it works, but through webpack, the infection does not want to.

Can you please tell me how to connect it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kovalsky, 2021-03-10
@lazalu68

An example on the office , it also says that "for basic usage Include the CSS and JS in"

V
Vlad, 2021-03-10
@Vextor-ltd

Well, it's written

Include the CSS and JS in and include the following line in your HTML.

JS is connected in one bundle at the bottom of the document, css is also one file on top. What is wrong?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question