Graphiql: webpack 1.15.0 cant parse 'codemirror-graphql/hint' && 'codemirror-graphql/lint'

Created on 23 Aug 2018  路  4Comments  路  Source: graphql/graphiql

I use codemirror-graphql according to the method in Getting Started.
But there is two file cant parse by webpack 1.15.0.

there is warning:

WARNING in ./~/[email protected]@graphql-language-service-interface/dist/getOutline.js.flow
Module parse failed: /Users/ahkari/Documents/tb-project/new-steins/node_modules/[email protected]@graphql-language-service-interface/dist/getOutline.js.flow Unexpected token (11:12)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (11:12)

codemirror-graphql

Most helpful comment

@Ahkari This is because webpack tried to bundleup .flow extension file, In order to exclude .flow extension files follow the below steps

First you need to install ignore-loader
npm install ignore-loader

In webpack.config.js file add the below module rule

module: {
        rules : [{ test: /\.flow$/, loader: 'ignore-loader' }]
    }

If you have more than one rule in module, you should place this rule in first order. This rule will exclude all .flow extension file from loader

All 4 comments

@Ahkari This is because webpack tried to bundleup .flow extension file, In order to exclude .flow extension files follow the below steps

First you need to install ignore-loader
npm install ignore-loader

In webpack.config.js file add the below module rule

module: {
        rules : [{ test: /\.flow$/, loader: 'ignore-loader' }]
    }

If you have more than one rule in module, you should place this rule in first order. This rule will exclude all .flow extension file from loader

It works, Thanks @KarthikNedunchezhiyan

Can this be closed?

this could also be achieved with the @babel/preset-flow

Was this page helpful?
0 / 5 - 0 ratings