E
E
Evgeny Kucherenko2017-02-01 15:10:04
webpack
Evgeny Kucherenko, 2017-02-01 15:10:04

How to include third-party libraries in the assembly?

Hello! I'm using Webpack and I have a build issue. I have third party folders with fonts and pictures. Is it possible to somehow bind them to the config so that they also appear in the project during the build?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2017-02-01
@evgenyspace

If these fonts and images should not be included in the build (and they probably shouldn't), then just put them in the "public directory".

...
// для продакшен конфига
output: {
    path: path.join(__dirname, 'production/public/'),
    filename: 'bundle.js',
    publicPath: '/',
  },
...
// для dev конфига
output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
...

Then somewhere in the code...
...
.mac-bg {
  background: url(/static/i/service/mac-bg.jpg) no-repeat;
  background-size: cover;
}
...

And the build directory:
3003f3c887984d67b8943a2c7b352e3b.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question