Answer the question
In order to leave comments, you need to log in
How to include jQuery plugins in Webpack?
Hello. I'm trying to connect the isotope filter to webpack. Installed it with npm, trying to import and use:
import $ from 'jquery';
import "isotope-layout";
var $grid = $(".our-design__gallery-items").isotope({
itemSelector: '.our-design__gallery-item',
});
$(".our-design__gallery-filters").on("click", "li", function(){
$grid.isotope({ filter: $(this).attr('data-filter') });
});
// webpack.config.js
var webpack = require('webpack');
module.exports = {
mode: 'development',
entry: './src/js/entry.js',
output: {
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
presets: [
['env', {modules: false}],
],
},
},{
}
],
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
],
devtool: 'source-map'
};
Uncaught TypeError: jquery__WEBPACK_IMPORTED_MODULE_0___default(...)(...).isotope is not a function
Answer the question
In order to leave comments, you need to log in
Jquery is a dinosaur, which is how you want to use it will not work. Need plugins.
https://webpack.js.org/plugins/provide-plugin/
isotope.metafizzy.co.s3-website-us-east-1.amazonaw...
See documentation
A very correct approach. This is exactly how a startup should be promoted. Still, potential customers are just waiting to be spammed about a cool new startup.
Be prudent. Few people are tolerant of spam. Most, even if they look at your startup, they definitely won’t want to buy. Why pay for a service that promotes itself so seriously.
Purchased bases are likely to have a very low response: you will get more problems with spam complaints than customers.
It's better to attract traffic with a virus of profit: making everyone who knows interested in attracting more people. Whether it's an iPhone raffle contest (honestly give away 1-2 sixths, or a few 5c is comparable to the purchase price of the base), the chances of winning grow in proportion to the number of people attracted by the participant. Or an opportunity for anyone to earn on the next referrals.
With the help of spam, you can only drive traffic to a startup that offers earnings from $ 700 per day without investment, working 3 hours a day.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question