U
U
uRoot2019-07-31 18:36:15
webpack
uRoot, 2019-07-31 18:36:15

How to include plugins in webpack?

I have this perennial problem. I don’t know how to properly connect plugins in webpack and don’t know a universal way. Please teach. There is webpack.config.js:

const path = require('path');
const outputDir = path.resolve(__dirname, 'build');

module.exports = {
    entry: path.resolve(__dirname, 'src/js/main.js'),
    output: {
        path: outputDir,
        filename: 'bundle.js'
    },
    module: {
        rules: [{
            test: require.resolve('jquery'),
            use: [{
                loader: 'expose-loader',
                options: '$'
            }]
        }]
    }
};

There is main.js where JS is connected from the components and the components themselves. Let's say I want to connect Fancybox 3 (or something else). How to do it right?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question