S
S
szQocks2021-10-29 23:09:54
webpack
szQocks, 2021-10-29 23:09:54

How to organize files into folders when building webpack 5?

in the output folder /distit turns out index.bundle.js, index.cssand index.html, and all files get into the same folder after assembling fonts, pictures, and so on.
Is it possible to somehow specify in webpack that he would throw all these pictures, fonts, etc. into a folder, for example , /dist/assetsor pictures into pictures, fonts into fonts, for example /dist/images, /dist/fontswithout the help of fs, of course.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kulakov, 2021-10-30
@szQocks

In webpack config:

output: {
  path: path.resolve(__dirname, './build'),
  filename: 'static/js/[name].[contenthash].js',
  crossOriginLoading: 'anonymous'
};

And in plugins:
new MiniCssExtractPlugin({ filename: 'static/css/[name].[contenthash].css', ignoreOrder: false }),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question