V
V
Victoria2018-03-31 14:14:47
JavaScript
Victoria, 2018-03-31 14:14:47

How to include third party libraries in webpack?

Good day!
Actually, the question is: I'm considering working with webpack. At the very least, jquery connected. But how to include, say, the following: Animate.css
( https://daneden.github.io/animate.css/ ), Particles.js ( https://vincentgarreau.com/particles.js/ ), fullPage.js ( https://alvarotrigo.com/fullPage/ )? What to import in index.js and how to write the path to the required css in styles.scss? Do I need to write something in the config? Maybe I'm dumb and don't get it. I would be grateful for the enlightenment.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Gerasimov, 2018-04-01
@Omashu

npm install animate.css --save
And in our root index.js we include:
In the webpack config there should be a loader for css, it looks like this:

{
        test: /\.css$/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options: {
              sourceMap: true,
            },
          }
        ]
      },

scss/sass can be included directly in styles.scss, like this:
@import '~bootstrap/scss/bootstrap.scss'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question