Skip to content

Webpack function in config is not called #41

@martonlederer

Description

@martonlederer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions