Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade webpack to 4.35.0 to fix dynamic import issue #7257

Merged
merged 2 commits into from
Jun 24, 2019
Merged
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 packages/react-error-overlay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"settle-promise": "1.0.0",
"source-map": "0.5.6",
"terser-webpack-plugin": "1.2.3",
"webpack": "^4.29.6"
"webpack": "^4.35.0"
},
"jest": {
"setupFiles": [
Expand Down
7 changes: 6 additions & 1 deletion packages/react-scripts/fixtures/kitchensink/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class App extends Component {
// This works around an issue of a duplicate hash in the href
// Ex: http://localhost:3001/#array-destructuring#array-destructuring
// This seems like a jsdom bug as the URL in initDom.js appears to be correct
const feature = url.slice(url.lastIndexOf("#") + 1);
const feature = url.slice(url.lastIndexOf('#') + 1);

switch (feature) {
case 'array-destructuring':
Expand Down Expand Up @@ -241,6 +241,11 @@ class App extends Component {
this.setFeature(f.default)
);
break;
case 'dynamic-import':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this even work? Also, the tests themselves use a dynamic import and they didn't break previously.

import('./features/webpack/DynamicImport').then(f =>
this.setFeature(f.default)
);
break;
default:
this.setState({ error: `Missing feature "${feature}"` });
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';

export default () => {
return <>Hello World!</>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom';

describe('dynamic import', () => {
it('renders without crashing', async () => {
import('./DynamicImport').then(DynamicImport => {
const div = document.createElement('div');
ReactDOM.render(<DynamicImport />, div);
expect(div.textContent).toBe('Hello World!');
});
});
});
2 changes: 1 addition & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"terser-webpack-plugin": "1.2.3",
"ts-pnp": "1.1.2",
"url-loader": "1.1.2",
"webpack": "4.29.6",
"webpack": "4.35.0",
"webpack-dev-server": "3.2.1",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "4.2.0"
Expand Down