Static GitHub Issues

[1862] Using query parameters in require statements: require('~/assets/something?test=true')

prev: nuxtServerInit triggers twice
next: How to integrate stylus global styl as a global color file?

Hi, I've encountered an issue I think might be due to the magic import handling for assets. Using nuxt 1.0.0-rc11.

I'm using responsive-loader to resize images from assets.

If I configure the loader in nuxt.config.js like this:

 extend: (config, { isClient }) => {
      const urlLoader = config.module.rules.find(
        rule => rule.loader === 'url-loader'
      );
      urlLoader.test = /\.(gif)$/;

      config.module.rules.push({
        test: /\.(jpe?g|png)$/i,
        loader: 'responsive-loader',
        options: {
          placeholder: true,
          placeholderSize: 20,
          sizes: [300]
        }
      });
    },

...then this works:

require(`~/assets/images/${item.key}/${i}.png`)

However, if I add a query parameter:

require(`~/assets/images/${item.key}/${i}.png?sizes[]=300`)

I get:

 Cannot find module "~/assets/images" 

Is this due to import handling, or have I misconfigured the loader?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1673">#c1673</a>)</em></sub></div>