Skip to content

Commit

Permalink
Add webpack loader for patching react-dom
Browse files Browse the repository at this point in the history
  • Loading branch information
jgierer12 committed Dec 13, 2018
1 parent de6d443 commit 3894f0a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/gatsby/src/utils/webpack-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ module.exports = async ({
}
},

reactHot: options => {
return {
options,
loader: require.resolve(`react-hot-loader/webpack`),
}
},

eslint: (schema = ``) => {
const options = eslintConfig(schema)

Expand Down Expand Up @@ -296,6 +303,18 @@ module.exports = async ({
rules.js = js
}

{
let reactHot = (options = {}) => {
return {
test: /\.jsx?$/,
include: /node_modules/,
use: [loaders.reactHot(options)],
}
}

rules.reactHot = reactHot
}

/**
* mjs loader:
* webpack 4 has issues automatically dealing with
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ module.exports = async (
let configRules = [
rules.mjs(),
rules.js(),
rules.reactHot(),
rules.yaml(),
rules.fonts(),
rules.images(),
Expand Down

0 comments on commit 3894f0a

Please sign in to comment.