I'm new with webpack (more used to grunt) and Symfony 4. I'm trying to add a simple js file for now.
I made a simple js file there
//assets/js/slide.js
function test(){
alert('test include');
}
A very basic twig to test the include works
{% block body %}
<h1 onclick="test();">Slides</h1>
{% endblock %}
In webpack.config.js I add this
.setOutputPath('public/build/')
.addEntry('js/app', [
'./assets/js/app.js',
'./node_modules/jquery/dist/jquery.slim.js',
'./node_modules/popper.js/dist/popper.min.js',
'./node_modules/bootstrap/dist/js/bootstrap.min.js',
'./node_modules/holderjs/holder.min.js',
'./assets/js/slide.js'
])
Then I run ./node_modules/.bin/encore dev
And I can see the function test is well generated into the app.js file.
But when I test to trigger the event:
Uncaught ReferenceError: test is not defined at
HTMLHeadingElement.onclick (slides:68) onclick @ slides:68
Then I think I am missing something here. That's for the simple question.
In fact; I have a full plugin to add (Reveal.js) which is there and has multiple folder that I need to keep, such as plugin / js / css: https://github.com/hakimel/reveal.js/#installation
How should I do that?