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

Added ternary operator to allow sourcemaps on gatsby-cli develop #17733

Closed
wants to merge 1 commit into from
Closed

Added ternary operator to allow sourcemaps on gatsby-cli develop #17733

wants to merge 1 commit into from

Conversation

BlackFenix2
Copy link
Contributor

Description

I added a Ternary operator to allow the source-map devtool in development environments while using the 'gatsby-plugin-no-sourcemaps' plugin.

Why did i make this PR?

Sourcemaps are still totes useful for debugging when running gatsby develop

Could this be better?

yeah, if i could pass in a plugin option to configure sourcemap generation

Ex:

{
  resolve: `gatsby-plugin-no-sourcemaps`,
  options: {
    allowDev:true,
  }
}

why didn't you make this better 👀

... i don't know how to take plugin options as an argument 🤷‍♂. i'm welcome to suggestions.

Related Issues

kind of a half-way fix for #3817

@BlackFenix2 BlackFenix2 requested a review from a team as a code owner September 19, 2019 02:12
@wardpeet
Copy link
Contributor

Hey,

Thanks for your PR. It's better to do this condition inside gatsby-config and don't load the plugin on development.

You can checkout

if (process.env.AIRTABLE_API_KEY) {
dynamicPlugins.push({
resolve: `gatsby-source-airtable`,
options: {
apiKey: process.env.AIRTABLE_API_KEY,
tables: [
{
baseId: `app0q5U0xkEwZaT9c`,
tableName: `Community Events Submitted`,
queryName: `CommunityEvents`,
},
],
},
})
}
on how we do this in gatsbyjs.org.

const plugins = [];

if (process.env.NODE_ENV !== 'development') {
   plugins.push(`gatsby-plugin-no-sourcemaps`)
}

module.exports = {
  // gatsby config
  plugins,
};

Thanks again, and we look forward to seeing more PRs from you in the future! 💪💜

@wardpeet wardpeet closed this Sep 20, 2019
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

Successfully merging this pull request may close these issues.

2 participants