Skip to content Skip to sidebar Skip to footer

Html Doesnt Read My Js Functions

Im using react to create a slideshow, the problem is that my html doesnt find the function to change the slide. It goes like this:

Solution 1:

Webpack normally doesn't expose things to window. You are expected to initialise from javascript. But you can tell webpack to export a library which will work like you want.

All you have to do is add this to the output config.

output: {
    filename: 'app.js',
    library: 'webpackLib',
    libraryTarget: 'window',
},

You have different options for the target, look in to documentation for more info.

Post a Comment for "Html Doesnt Read My Js Functions"