Answers for "how to get webpack to process jpg"

3

how to get webpack to process jpg

npm install --save-dev file-loader

 const path = require('path');

  module.exports = {
    entry: './src/index.js',
    output: {
      filename: 'bundle.js',
      path: path.resolve(__dirname, 'dist'),
    },
    module: {
      rules: [
        {
          test: /\.css$/,
          use: [
            'style-loader',
            'css-loader'
          ],
        },
+       {
+         test: /\.(png|svg|jpg|gif)$/,
+         use: [
+           'file-loader',
+         ],
+       },
      ],
    },
  };
Posted by: Guest on February-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language