J
J
Jedi2020-04-21 16:38:55
JavaScript
Jedi, 2020-04-21 16:38:55

How to connect a third-party regular script?

Help to connect the script, please.

In the documentation, everything is simple: Create a tag script, add paths, and then run the script in another tag.

I want to do this all in one file which is compiled by webpack into one final file.

The problem is that I can't call the function in any way...

<!-- Скрипты -->
<script src="js/builder.js"></script>
<script src="js/content.js"></script>

<script src="js/config.js"></script>

<script>
    const builder = new ContentBuilder({
        container: '.container',
        snippetOpen: true,
        clearPreferences: true
    });
</script>


How to do the same in es6 (Webpack) ? I have a constant error that ContentBuilder is not defined.

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2020-04-21
@PHPjedi

add import? Something like:

import ContentBuilder from './ContentBuilder'; // путь явно не корректный, исправьте на правильный

const builder = new ContentBuilder({
        container: '.container',
        snippetOpen: true,
        clearPreferences: true
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question