Skip to content

Commit d31645c

Browse files
authored
chore(gatsby): add webpack file to export same version (#33126)
* chore(gatsby): add webpack export * add patch file to move to gatsby/webpack
1 parent 44afaf5 commit d31645c

File tree

4 files changed

+68
-7
lines changed

4 files changed

+68
-7
lines changed

packages/gatsby-plugin-netlify-cms/src/gatsby-node.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,11 @@ exports.onCreateWebpackConfig = (
200200
}),
201201

202202
// Pass in needed Gatsby config values.
203-
new webpack.DefinePlugin({
203+
plugins.define({
204204
__PATH__PREFIX__: pathPrefix,
205205
CMS_PUBLIC_PATH: JSON.stringify(publicPath),
206+
CMS_MANUAL_INIT: JSON.stringify(manualInit),
207+
PRODUCTION: JSON.stringify(stage !== `develop`),
206208
}),
207209

208210
new CopyPlugin({
@@ -225,11 +227,6 @@ exports.onCreateWebpackConfig = (
225227
tags: externals.map(({ assetName }) => assetName),
226228
append: false,
227229
}),
228-
229-
new webpack.DefinePlugin({
230-
CMS_MANUAL_INIT: JSON.stringify(manualInit),
231-
PRODUCTION: JSON.stringify(stage !== `develop`),
232-
}),
233230
].filter(p => p),
234231

235232
// Remove common chunks style optimizations from Gatsby's default
@@ -281,7 +278,7 @@ exports.onCreateWebpackConfig = (
281278
plugins: enableIdentityWidget
282279
? []
283280
: [
284-
new webpack.IgnorePlugin({
281+
plugins.ignore({
285282
resourceRegExp: /^netlify-identity-widget$/,
286283
}),
287284
],

packages/gatsby/webpack.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import webpack from "webpack"
2+
3+
export = webpack

packages/gatsby/webpack.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"use strict"
2+
3+
module.exports = require('webpack');
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
diff --git a/packages/gatsby-plugin-mdx/package.json b/packages/gatsby-plugin-mdx/package.json
2+
index 4fa83e356f..4e18ac3fa0 100644
3+
--- a/packages/gatsby-plugin-mdx/package.json
4+
+++ b/packages/gatsby-plugin-mdx/package.json
5+
@@ -14,6 +14,7 @@
6+
"directory": "packages/gatsby-plugin-mdx"
7+
},
8+
"peerDependencies": {
9+
+ "gatsby": "^4.0.0-alpha-9689ff",
10+
"@mdx-js/mdx": "^1.0.0",
11+
"@mdx-js/react": "^1.0.0",
12+
"react": "^16.9.0 || ^17.0.0",
13+
diff --git a/packages/gatsby-plugin-mdx/utils/render-html.js b/packages/gatsby-plugin-mdx/utils/render-html.js
14+
index 16d1080b21..ab390241b3 100644
15+
--- a/packages/gatsby-plugin-mdx/utils/render-html.js
16+
+++ b/packages/gatsby-plugin-mdx/utils/render-html.js
17+
@@ -1,4 +1,4 @@
18+
-const webpack = require(`webpack`)
19+
+const webpack = require(`gatsby/webpack`)
20+
const path = require(`path`)
21+
const evaluate = require(`eval`)
22+
const debug = require(`debug`)(`gatsby-plugin-mdx:render-html`)
23+
diff --git a/packages/gatsby-plugin-netlify-cms/package.json b/packages/gatsby-plugin-netlify-cms/package.json
24+
index cdd3644243..c84c97d074 100644
25+
--- a/packages/gatsby-plugin-netlify-cms/package.json
26+
+++ b/packages/gatsby-plugin-netlify-cms/package.json
27+
@@ -15,8 +15,7 @@
28+
"html-webpack-tags-plugin": "^3.0.1",
29+
"lodash": "^4.17.21",
30+
"mini-css-extract-plugin": "1.6.2",
31+
- "netlify-identity-widget": "^1.9.2",
32+
- "webpack": "^5.35.0"
33+
+ "netlify-identity-widget": "^1.9.2"
34+
},
35+
"devDependencies": {
36+
"@babel/cli": "^7.15.4",
37+
@@ -40,7 +39,8 @@
38+
"gatsby": "^4.0.0-alpha-9689ff",
39+
"netlify-cms-app": "^2.9.0",
40+
"react": "^16.9.0 || ^17.0.0",
41+
- "react-dom": "^16.9.0 || ^17.0.0"
42+
+ "react-dom": "^16.9.0 || ^17.0.0",
43+
+ "webpack": "^5.0.0"
44+
},
45+
"repository": {
46+
"type": "git",
47+
diff --git a/packages/gatsby-plugin-netlify-cms/src/gatsby-node.js b/packages/gatsby-plugin-netlify-cms/src/gatsby-node.js
48+
index 3f060702bb..bb04a2a389 100644
49+
--- a/packages/gatsby-plugin-netlify-cms/src/gatsby-node.js
50+
+++ b/packages/gatsby-plugin-netlify-cms/src/gatsby-node.js
51+
@@ -1,6 +1,6 @@
52+
import path from "path"
53+
import { mapValues, isPlainObject, trim } from "lodash"
54+
-import webpack from "webpack"
55+
+import webpack from "gatsby/webpack"
56+
import HtmlWebpackPlugin from "html-webpack-plugin"
57+
import { HtmlWebpackSkipAssetsPlugin } from "html-webpack-skip-assets-plugin"
58+
import MiniCssExtractPlugin from "mini-css-extract-plugin"

0 commit comments

Comments
 (0)