Skip to content

Commit 983b167

Browse files
committed
Fix json-inclusion and linked-modules features by adding a custom json-loader rule
1 parent c7e0070 commit 983b167

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ module.exports = function(webpackEnv) {
569569
name: 'static/media/[name].[hash:8].[ext]',
570570
},
571571
},
572+
// Webpack 5 Change: For some reason the default json-loader wasn't being used.
573+
// This might be due to the type property I had to add to the first `parser.requireEnsure` rule?
574+
{ test: /\.json$/, loader: require.resolve('json-loader') },
572575
// ** STOP ** Are you adding a new loader?
573576
// Make sure to add the new loader(s) before the "file" loader.
574577
],

packages/react-scripts/fixtures/kitchensink/template/src/App.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,16 @@ class App extends Component {
156156
this.setFeature(f.default)
157157
);
158158
break;
159-
// case 'json-inclusion':
160-
// import('./features/webpack/JsonInclusion').then(f =>
161-
// this.setFeature(f.default)
162-
// );
163-
// break;
164-
// case 'linked-modules':
165-
// import('./features/webpack/LinkedModules').then(f =>
166-
// this.setFeature(f.default)
167-
// );
168-
// break;
159+
case 'json-inclusion':
160+
import('./features/webpack/JsonInclusion').then(f =>
161+
this.setFeature(f.default)
162+
);
163+
break;
164+
case 'linked-modules':
165+
import('./features/webpack/LinkedModules').then(f =>
166+
this.setFeature(f.default)
167+
);
168+
break;
169169
case 'no-ext-inclusion':
170170
import('./features/webpack/NoExtInclusion').then(f =>
171171
this.setFeature(f.default)

packages/react-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"jest-environment-jsdom-fourteen": "1.0.1",
5959
"jest-resolve": "24.9.0",
6060
"jest-watch-typeahead": "0.4.2",
61+
"json-loader": "0.5.7",
6162
"mini-css-extract-plugin": "0.9.0",
6263
"optimize-css-assets-webpack-plugin": "5.0.3",
6364
"path-browserify": "1.0.1",

0 commit comments

Comments
 (0)