Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
14
12 changes: 7 additions & 5 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ module.exports = {
image: `/assets/tl-favicon.svg`,
},
plugins: [
`gatsby-plugin-sass`,
"gatsby-transformer-sharp",
"gatsby-plugin-sharp",
{
resolve: `gatsby-plugin-sass`,
},
{
resolve: `gatsby-source-filesystem`,
options: {
Expand All @@ -31,7 +31,6 @@ module.exports = {
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
},
},
`@contentful/gatsby-transformer-contentful-richtext`,
`gatsby-transformer-remark`,
{
resolve: `gatsby-plugin-gdpr-cookies`,
Expand All @@ -46,7 +45,7 @@ module.exports = {
},
},
{
resolve: `gatsby-plugin-intl`,
resolve: `gatsby-plugin-react-intl`,
options: {
// language JSON resource path
path: `${__dirname}/src/intl`,
Expand All @@ -73,5 +72,8 @@ module.exports = {
`gatsby-plugin-remove-serviceworker`,
`gatsby-plugin-eslint`,
"gatsby-plugin-next-seo",
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
],
}
42 changes: 41 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ exports.createPages = ({ graphql, actions }) => {
return new Promise((resolve, reject) => {
const locationTemplate = path.resolve("./src/templates/location.js")
const talksTemplate = path.resolve("./src/templates/talks.js")
const talksregisterTemplate = path.resolve("./src/templates/talksregister.js")
const talksregisterTemplate = path.resolve(
"./src/templates/talksregister.js"
)
resolve(
graphql(
`
Expand Down Expand Up @@ -91,3 +93,41 @@ exports.createPages = ({ graphql, actions }) => {
)
})
}

exports.onCreateWebpackConfig = ({
stage,
actions,
getConfig,
loaders,
plugins,
}) => {
const config = getConfig()
const miniCssExtractPluginIndex = config.plugins.findIndex(
plugin => plugin.constructor.name === "MiniCssExtractPlugin"
)

if (miniCssExtractPluginIndex > -1) {
// remove miniCssExtractPlugin from plugins list
config.plugins.splice(miniCssExtractPluginIndex, 1)

// re-add mini-css-extract-plugin
if (stage === "build-javascript") {
config.plugins.push(
plugins.extractText({
filename: `[name].[contenthash].css`,
chunkFilename: `[name].[contenthash].css`,
ignoreOrder: true,
})
)
} else {
config.plugins.push(
plugins.extractText({
filename: `[name].css`,
chunkFilename: `[id].css`,
ignoreOrder: true,
})
)
}
}
actions.replaceWebpackConfig(config)
}
Loading