Gatsby: Add babel-plugin-transform-react-remove-prop-types

Created on 16 Jun 2019  路  11Comments  路  Source: gatsbyjs/gatsby

Summary

I am not 100% sure, but it seems like babel-plugin-transform-react-remove-prop-types isn't being used when gatsby is building for production.

In my opinion, this is a very useful and practical thing to add.

Basic example

N/A

Motivation

To achieve smaller production build bundle.

good first issue

Most helpful comment

Plan is to merge this today (we are doing bunch of babel preset related changes)

All 11 comments

Sounds useful but I'm not _entirely_ sure if we should add it in our default config (which is super lightweight by design).

Let's keep this open and hear what everyone else has to say.

In the mean time, you could add this in a custom .babelrc file

Just spoke with @DSchau about this and we both agree that this is useful indeed!

We would love to accept a PR with this. 馃挭

Hi,

Can I try to tackle this one?

Cheers

@luisFilipePT Sure! Thank you for picking it up 馃檶

@luisFilipePT You should be able to add it to babel-preset-gatsby/src/index.js

@wardpeet thanks for the tip 馃憤
[UPDATED]
I started to check it out last night, just not sure yet how to test it, this is what I have tried (so far)

1 - Added the npm package in packages/babel-preset-gatsby
2 - Added the config to src/index.js
3 - Built everything
4 - Test with build the default starter
5 - Go to public and search for propTypes in that folder
6 - Compare with the original build (before the change)

Am I on the right path? 馃槃 No luck yet :/

PS - The goal here, for now, is just to remove propTypes on Gatsby prod but not on the plugins, right?

Thanks guys

kind of struggling here, this are my current changes:

I'm missing something 馃槙

image

any clues? 馃槃

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

@luisFilipePT how is this going? I might be able to help you out

@luisFilipePT how is this going? I might be able to help you out

I think it's done. You can check the PR and see if theres anything that could be improved.
But for now I am just waiting for feedback or for the PR to be merged 馃槃

Plan is to merge this today (we are doing bunch of babel preset related changes)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

mikestopcontinues picture mikestopcontinues  路  3Comments