Skip to content

Commit

Permalink
fix: pnpm plugin now resolve all node modules
Browse files Browse the repository at this point in the history
closes #40
  • Loading branch information
Marvin Heilemann committed Feb 5, 2020
1 parent 51a9999 commit cb9ce7a
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 62 deletions.
72 changes: 35 additions & 37 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,18 @@ module.exports = {
},
},
},
{
resolve: 'gatsby-source-graphql',
options: {
typeName: 'GCMS',
fieldName: 'gcms',
url: 'https://api-euwest.graphcms.com/v1/ck5xls94g1wlo01fl4vg1fvlt/master',
headers: {
Authorization: `Bearer ${process.env.GRAPH_CMS_PAT}`,
},
},
},
// Not used ATM
// {
// resolve: 'gatsby-source-graphql',
// options: {
// typeName: 'GCMS',
// fieldName: 'gcms',
// url: 'https://api-euwest.graphcms.com/v1/ck5xls94g1wlo01fl4vg1fvlt/master',
// headers: {
// Authorization: `Bearer ${process.env.GRAPH_CMS_PAT}`,
// },
// },
// },
{
resolve: 'gatsby-source-graphql',
options: {
Expand All @@ -100,10 +101,11 @@ module.exports = {
},
},
{
// TODO: wait for https://github.com/gatsbyjs/gatsby/issues/21219
resolve: `gatsby-source-files`,
options: {
name: `package`,
files: [`${__dirname}/CHANGELOG.md`, `${__dirname}/TODO.md`],
files: [`${__dirname}/CHANGELOG.md`],
},
},
{
Expand Down Expand Up @@ -134,13 +136,24 @@ module.exports = {
path: `${__dirname}/content/writings`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `leasot`,
// TODO: wait for https://github.com/gatsbyjs/gatsby/issues/21219
path: `${__dirname}/gatsby`,
},
},
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.mdx`, `.md`],
defaultLayouts: {
default: require.resolve('./src/templates/PageSingle.jsx'),
},
// BUG: https://github.com/gatsbyjs/gatsby/issues/15486
plugins: [`gatsby-remark-images`],
rehypePlugins: [require(`rehype-accessible-emojis`).rehypeAccessibleEmojis],
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-autolink-headers`,
Expand All @@ -149,7 +162,6 @@ module.exports = {
icon: `<svg height="256" viewBox="0 0 512 256" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m384 0h-64c-6.333376 0-11.499968 2-15.500032 6-4 4-6 9.166656-6 15.500032 0 6.333312 2 11.499968 6 15.499968 4.000064 4 9.166656 6 15.500032 6h64c23.33344 0 43.416576 8.333248 60.249984 25s25.250048 36.66656 25.250048 60c0 23.666816-8.41664 43.83328-25.250048 60.499968-16.833408 16.666784-36.916544 25.000032-60.249984 25.000032h-64c-6.333376 0-11.499968 1.916646-15.500032 5.749997-4 3.833357-6 9.083302-6 15.750003 0 6.333363 2 11.416646 6 15.25 4.000064 3.833352 9.166656 5.75 15.500032 5.75h64c17.666752 0 34.166592-3.3333 49.500032-10 15.666688-6.666701 29.333248-15.833274 40.999936-27.5 11.666752-11.666726 20.833344-25.166592 27.500032-40.5 6.666688-15.666752 10-32.333248 10-50 0-17.33344-3.333312-33.83328-10-49.500032-6.666688-15.666688-15.83328-29.24992-27.500032-40.749952-11.666688-11.500096-25.333248-20.583296-40.999936-27.250048-15.33344-7-31.83328-10.499968-49.500032-10.499968zm-192 213.5h-64c-23.33344 0-43.416576-8.333248-60.249984-25.000032-16.8334336-16.666688-25.250016-36.833152-25.250016-60.499968 0-23.33344 8.4165824-43.333248 25.250016-60 16.833408-16.666752 36.916544-25 60.249984-25h64c6.333376 0 11.499968-2 15.500032-6 4-4 6-9.166656 6-15.499968 0-6.333376-2-11.500032-6-15.500032-4.000064-4-9.166656-6-15.500032-6h-64c-17.666752 0-34.166592 3.499968-49.500032 10.499968-15.6667136 6.666752-29.3332416 15.749952-40.999968 27.250048-11.6667264 11.500032-20.8332992 25.083264-27.5 40.749952-6.66670016 15.666752-10 32.166592-10 49.500032 0 17.666752 3.33329984 34.333248 10 50 6.6667008 15.333408 15.8332736 28.833274 27.5 40.5s25.3332544 20.833299 40.999968 27.5c15.33344 6.6667 31.83328 10 49.500032 10h64c6.333376 0 11.499968-1.916648 15.500032-5.75 4-3.833354 6-8.916637 6-15.25 0-6.666701-2-11.916646-6-15.750003-4.000064-3.833351-9.166656-5.749997-15.500032-5.749997zm-42.499968-85.5c0 6.666688 1.916608 11.916672 5.749952 15.750016s8.916672 5.750016 15.249984 5.750016h171.000064c6.333312 0 11.41664-1.916672 15.249984-5.750016s5.749952-9.083328 5.749952-15.750016c0-6.333376-1.916608-11.41664-5.749952-15.249984s-8.916672-5.750016-15.249984-5.750016h-171.000064c-6.333312 0-11.41664 1.916672-15.249984 5.750016s-5.749952 8.916608-5.749952 15.249984z" fill-rule="evenodd"/></svg>`,
},
},
'gatsby-remark-check-links',
{
// BUG: https://github.com/gatsbyjs/gatsby/issues/16239
resolve: 'gatsby-remark-images',
Expand All @@ -163,16 +175,17 @@ module.exports = {
showCaptions: true,
},
},
'gatsby-remark-check-links',
`gatsby-remark-copy-linked-files`,
{
resolve: 'gatsby-remark-emoji',
options: {
emojiConversion: 'shortnameToUnicode',
},
},
],
// BUG: https://github.com/gatsbyjs/gatsby/issues/15486
plugins: [`gatsby-remark-images`],
},
},
{
resolve: `gatsby-transformer-leasot`,
options: {
sourceInstanceName: `leasot`,
customTags: [`BUG`], // additionally to: TODO, FIXME
mode: 'mdx',
},
},
`gatsby-plugin-remove-trailing-slashes`,
Expand All @@ -182,22 +195,7 @@ module.exports = {
resolve: `gatsby-plugin-breadcrumb`,
options: {
useAutoGen: true,
useClassNames: true,
exclude: [`/404`],
crumbLabelUpdates: [
{
pathname: '/projects',
crumbLabel: 'Projects',
},
{
pathname: '/photography',
crumbLabel: 'Photography',
},
{
pathname: '/writings',
crumbLabel: 'Writings',
},
],
},
},
{
Expand Down Expand Up @@ -252,7 +250,7 @@ module.exports = {
removeVersionOnly: true,
},
},
// BUG: https://github.com/angeloashmore/gatsby-plugin-react-axe/issues/6
// ISSUE(#35): Setup Axe
// isDev && 'gatsby-plugin-react-axe',
{
resolve: 'gatsby-plugin-webpack-bundle-analyzer',
Expand Down
9 changes: 0 additions & 9 deletions gatsby/node/onCreateWebpackConfig.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
const path = require('path')
const { getVersion } = require('../../utils/version')
const { isProd } = require('../../utils/environment')

// BUG: https://github.com/webpack/webpack/issues/5087
// BUG: https://github.com/Js-Brecht/gatsby-plugin-pnpm/issues/1
const nodePath = (process.env.NODE_PATH &&
process.env.NODE_PATH.split(path.delimiter)) || [path.join(__dirname, 'node_modules')]

module.exports = async ({ actions, plugins }) => {
const { setWebpackConfig } = actions

await setWebpackConfig({
devtool: isProd ? false : 'cheap-module-source-map',
resolveLoader: {
modules: nodePath,
},
plugins: [
plugins.define({
'process.env': {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"autoprefixer": "^9.7.4",
"copy-text-to-clipboard": "^2.1.1",
"cssnano": "^4.1.10",
"dayjs": "^1.8.19",
"dayjs": "^1.8.20",
"dot-prop": "^5.2.0",
"gatsby": "^2.19.12",
"gatsby-image": "^2.2.40",
Expand All @@ -53,7 +53,7 @@
"gatsby-plugin-manifest": "^2.2.41",
"gatsby-plugin-mdx": "^1.0.70",
"gatsby-plugin-offline": "^3.0.34",
"gatsby-plugin-pnpm": "^1.0.0",
"gatsby-plugin-pnpm": "^1.1.0",
"gatsby-plugin-postcss": "^2.1.20",
"gatsby-plugin-preact": "^3.1.26",
"gatsby-plugin-react-axe": "^0.3.0",
Expand All @@ -73,6 +73,7 @@
"gatsby-source-filesystem": "^2.1.48",
"gatsby-source-graphql": "^2.1.33",
"gatsby-transformer-json": "^2.2.26",
"gatsby-transformer-leasot": "^1.1.1",
"gatsby-transformer-sharp": "^2.3.14",
"lodash": "^4.17.15",
"moment": "^2.24.0",
Expand Down
Loading

0 comments on commit cb9ce7a

Please sign in to comment.