I want to run the simpleWeather jQuery Plugin in the browser by using the npm module. I heard that I need to use a bundler, so I installed webpack.
This is the folder structure:
-
Weather
- js
- index.js
- node_modules
- jquery
- simpleqeather
- index.html
- package.json
- webpack.config.js
simpleWeather.minimum.js
$(document).ready(function() { $.simpleWeather({ location: 'Austin, TX', woeid: '', unit: 'f', success: function(weather) { html = '
'+weather.temp+'°'+weather.units.temp+'
';$("#weather").html(html); }, error: function(error) { $("#weather").html('<p>'+error+'</p>'); }
}); });
module.exports = { entry: "./js/index.js", output: { filename: "js/bundle.js" } }
- js
This does not work in the browser, I guess, I need to configure Webpack in some different way.
What do I need to do?
via user371
No comments:
Post a Comment