A
A
Alex2021-01-18 16:19:27
JavaScript
Alex, 2021-01-18 16:19:27

How to write configuration in webpack5?

Good afternoon in webpack5 the following config for generating images

// IMAGES

                {
                    test: /\.(png|jpg|gif|webp)$/,
                    type: 'asset/resource',
                    generator: {
                        filename: '../dist/images/[name][ext]'
                    }

                },

That is, ../dist/images/ is generated correctly, but the path in css style compiles ../dist/images/ and how to do ../images/ Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
be_a_man, 2021-01-18
@be_a_man

output: {
        path: path.resolve(__dirname, 'dist'),
        publicPath: '/'
    },

{
                    test: /\.(png|jpg|gif|webp)$/,
                    type: 'asset/resource',
                    generator: {
                        filename: 'images/[name].[ext]'
                    }

                },

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question