cyrilwanner / next-compose-plugins

💡next-compose-plugins provides a cleaner API for enabling and configuring plugins for next.js
MIT License
736 stars 12 forks source link

Webpack function in config is not called #41

Open martonlederer opened 3 years ago

martonlederer commented 3 years ago

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
dustinlacewell commented 3 years ago

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