Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
fix: re-reduce bundle size
Browse files Browse the repository at this point in the history
* We missed some imports from the default theme exporter file during PR
  review
* This lead to our bundle size being increase back to what it was before
  we worked on it
* This corrects those imports and adds an eslint rule to help us avoid
  this issue in the future
* Also renames QuickstartGrid to `js` instead of `jsx` so that eslint
  picks it up
  • Loading branch information
aswanson-nr committed Aug 17, 2022
1 parent ebe5eb7 commit 84d8f40
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,20 @@ module.exports = {
ignoreRestSiblings: false,
},
],
// This prevents us from accidently importing from the theme's `index` file
// and pulling in a bunch of extra dependecies.
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@newrelic/gatsby-theme-newrelic',
message:
'Please import the module directly from @newrelic/gatsby-theme-newrelic/src/[module] instead.',
},
],
patterns: ['!@newrelic/gatsby-theme-newrelic/*'],
},
],
},
};
2 changes: 1 addition & 1 deletion src/components/GoToTopButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/react';

import { Button } from '@newrelic/gatsby-theme-newrelic';
import Button from '@newrelic/gatsby-theme-newrelic/src/components/Button';

import featherIcons from '@newrelic/gatsby-theme-newrelic/src/icons/feather';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { css } from '@emotion/react';
import { Button, Surface } from '@newrelic/gatsby-theme-newrelic';
import Button from '@newrelic/gatsby-theme-newrelic/src/components/Button';
import Surface from '@newrelic/gatsby-theme-newrelic/src/components/Surface';
import QuickstartTile from '@components/QuickstartTile';
import { quickstart } from '../types';

Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import allFilteredQuickstarts from '@utils/allFilteredQuickstarts';
import getDisplayName from '@utils/getDisplayName';
// Components
import Slider from 'react-slick';
import { Spinner } from '@newrelic/gatsby-theme-newrelic';
import Spinner from '@newrelic/gatsby-theme-newrelic/src/components/Spinner';
import IOBanner from '@components/IOBanner';
import IOSeo from '@components/IOSeo';
import QuickstartTile from '@components/QuickstartTile';
Expand Down

0 comments on commit 84d8f40

Please sign in to comment.