backpack icon indicating copy to clipboard operation
backpack copied to clipboard

Live reload on .graphql files

Open peterpetre opened this issue 6 years ago • 6 comments

Is it possible right now to config file extensions to watch and reload? for graphql files i m using graphql-import.

peterpetre avatar Feb 27 '18 11:02 peterpetre

Perhaps in addition to passing node args, we could also pass nodemon args here and use -e js,graphql as documented here.

Thoughts @jaredpalmer?

migueloller avatar Apr 05 '18 18:04 migueloller

I had luck using the graphql-import-loader and the below backpack config:

module.exports = {
  webpack: (config, options, webpack) => {
    config.module.rules.push({
      exclude: /node_modules/,
      test: /\.graphql$/,
      use: [{ loader: 'graphql-import-loader' }],
    })
    return config
  },
}

ctrlplusb avatar Apr 18 '18 08:04 ctrlplusb

I'd love to have this!

mxstbr avatar Nov 08 '18 09:11 mxstbr

@ctrlplusb 's solution works but it requires me to make changes in js file ( index.js ) to get the updates in the playground and also I've to manually refresh the playground so yeah "live-reload" doesn't work :|

5achinJani avatar Mar 01 '19 10:03 5achinJani

@5achinJani you can add this in the backpack.config.js file as a workaround

const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin')

module.exports = {
  webpack: (config, options, webpack) => {
    config.plugins.push(
      new ExtraWatchWebpackPlugin({
        files: ['<path-to-graphql-files>'],
      })
    )

    return config
  },
}

ryands17 avatar Mar 05 '19 08:03 ryands17

Thanks @ryands17 that works like charm.

5achinJani avatar Mar 05 '19 08:03 5achinJani