next-compose-plugins icon indicating copy to clipboard operation
next-compose-plugins copied to clipboard

Webpack function in config is not called

Open martonlederer opened this issue 4 years ago • 1 comments

I am trying to add "graphql-tag" to the webpack loaders, but the webapck function in the nextjs config is not being called.

Here's my next.config.js:

const withPlugins = require('next-compose-plugins'),
  withImages = require('next-images')

module.exports = withPlugins([withImages()], {
  i18n: {
    locales: ['en-US', 'hu'],
    defaultLocale: 'hu'
  },
  webpack(config, options) {     
    config.module.rules.push({
      test: /\.(graphql|gql)$/,
      use: [
        {
          loader: require.resolve('graphql-tag/loader')
        }
      ]
    })

    return config
  }
})

The missing loader error is still being thrown:

error - ./queries/products.gql 1:6
Module parse failed: Unexpected token (1:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> query {
|   allProducts {
|     id

martonlederer avatar Dec 09 '20 15:12 martonlederer

Why hasn't this been addressed? Makes this library nearly unusable.

dustinlacewell avatar May 16 '21 16:05 dustinlacewell