Skip to content

Doesn't work with webpack 5 (support needed?) #39

@mortware

Description

@mortware

I think this version does not work with webpack 5. I have the following:

{
  test: /\.(gif|jpe?g|png|svg|tiff)(\?.*)?$/,
  include: [path.resolve(__dirname, 'src/photography')],
  loader: "sharp-loader",
  options: {
    name: "[name].[hash:8].[ext]",
    cacheDirectory: true,
    presets: {
      // Preset 1
      thumbnail: {
        format: ["webp", "jpeg"],
        width: 200,
        quality: 60,
      },
      // Preset 2
      prefetch: {
        // Format-specific options can be specified like this:
        format: { id: "jpeg", quality: 30 },
        mode: "cover",
        blur: 100,
        inline: true,
        size: 50,
      },
    },
  },
},
// Images: Copy image files to build folder
{ test: /\.(?:ico|gif|png|jpg|jpeg)$/i, type: 'asset/resource' }

import testImage from '../../photography/fullsizeoutput_203a.jpeg?{"outputs":["thumbnail"]}';

It appears the query parameters are ignored and the result of testImage is undefined. Is this something to do with the new asset modules?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions