Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 Modules #468

Closed
mjurczyk opened this issue Sep 26, 2016 · 2 comments
Closed

ES6 Modules #468

mjurczyk opened this issue Sep 26, 2016 · 2 comments

Comments

@mjurczyk
Copy link
Contributor

Issue

In the latest build of Gatsby, loaders doesn't seem to work with ES6 modules' import/export, even though sample loaders are written with those.

The issue occurs when I try to modify a loader, if I leave them as they are after installation, nothing seems to happen.

import/export seem to work perfectly for pages/.

Specs

Gatsby ver. - 0.12.9
Node ver. - v5.0.0
OS - macOS Sierra v10.12

@KyleAMathews
Copy link
Contributor

This is an oddity around Babel and .babelrc. Gatsby sets Webpack up to load JS files for your project JS files using babel-loader but afaik doesn't let you use the same babel-loader setup for loading custom loaders. Those only use Babel if you put a .babelrc in your project directory.

I removed the .babelrcs from the official starters recently which is perhaps is causing the problem you're seeing?

So the easiest thing you can do is to just drop a .babelrc in your project e.g. restore gatsbyjs/gatsby-starter-default@ba341b9

It'd also be great if you wanted to investigate if there's a way to make Webpack load loaders using babel-loader. I don't think there is but it'd be nice.

@jbolda jbolda closed this as completed Jul 11, 2017
@SanthoshRaju91
Copy link

@KyleAMathews I have a similar, I don't want open up another issue.

In gatsby-node.js, importing writing a source plugin

import { GraphQLClient } from 'graphql-request'

This throws me the same error, even though I added a .babelrc and downloaded babel-present-env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants