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

[WP5] Webpack5 update #10961

Merged
merged 62 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
cdb7ec0
Revert "Revert "Update postcss packages" (#10216)"
Jan 27, 2021
878f8c4
Merge remote-tracking branch 'upstream/master'
Mar 6, 2021
79b16d4
Revert "Update postcss packages" (#10216)
ianschmitz Dec 8, 2020
8d5d16f
Update postcss and loader
Jan 27, 2021
0254dc9
Update [email protected]
Nov 3, 2020
6777da0
Update fork-ts-checker-webpack-plugin 6.0.5
Dec 5, 2020
f959414
Add [email protected] remove
Nov 4, 2020
fb56a14
Add support for Webpack 5 message objects
jasonwilliams Nov 20, 2020
48c5456
Update WebpackManifestPlugin to v3.0.0
Dec 5, 2020
468ffe6
Support both "SingleEntryPlugin" and "EntryPlugin"
Dec 5, 2020
4d0be4a
Support Webpack 5 IgnorePlugin signature
Mar 6, 2021
cfee807
Update webpack and dev server
Mar 6, 2021
38d72e7
Enable persistent cache
Mar 6, 2021
5bef914
Fix react-error-overlay webpack
Mar 6, 2021
58d36c2
Fix dev server config
Mar 6, 2021
a89a63a
Remove support for SingleEntryPlugin
Mar 6, 2021
74ed0c7
update workbox-webpack-plugin
Mar 6, 2021
19faf8c
Fix post css config
Mar 6, 2021
bbf93d2
Comment out WebpackManifestPlugin for now having issues with undefine…
Mar 6, 2021
73c952b
Add fast refresh entries to ModuleScopePlugin
Mar 6, 2021
33f9064
Format files
Mar 6, 2021
5e79ffa
Remove unused variables in start command
Mar 6, 2021
c0e4c4d
git ignore tsconfig.tsbuildinfo
Mar 6, 2021
871b2e9
simplify output path
Mar 20, 2021
613e2a5
Use asset modules in react-scripts
Mar 20, 2021
952f896
Use asset modules in react-error-overlay
Mar 20, 2021
651d0db
eslint-config-react-app typo fix (#10317)
Spacerat May 12, 2021
b680ee7
Fix link address (#10907)
May 12, 2021
281a868
Bump immer version for fixing security issue (#10791)
shamprasadrh May 12, 2021
7bdeced
test(create-react-app): add integration tests (#10381)
jamesgeorge007 May 12, 2021
2217ab7
Revert "Use asset modules in react-error-overlay"
May 14, 2021
6eef86c
Disable broken tests for now
May 14, 2021
0170343
Merge remote-tracking branch 'upstream/wp5' into webpack5-update
May 14, 2021
beb6e0e
Revert source-map bump in react-error-overlay
May 14, 2021
7234425
JSON is using default export
May 14, 2021
06fbbd0
Webpack config: Remove invalid parser configuration
May 14, 2021
0190603
Fix issue with ModuleScope and babel runtime
May 14, 2021
d709342
Fix svgr configuration
May 14, 2021
a35d315
Webpack config svg use file-loader instead of url-loader
May 14, 2021
236fd9c
Update postcss-normalize
May 14, 2021
a002e34
Fix asset output name
May 14, 2021
01e8444
Update test matrix using node 12+14
May 14, 2021
43a0d0d
Fix file output extension
May 14, 2021
506c13b
Align assetModuleFilename
May 14, 2021
9d6f4a9
pipeline update configuration names
May 14, 2021
6f683db
Add back webpack-manifest-plugin
May 15, 2021
819936b
Fix kitchen sink get actual href value
May 15, 2021
96d8f15
Update kitchen sink test to webpack 5 asset modules
May 15, 2021
f56887a
Let webpack handle global this
May 15, 2021
73f20aa
Fix eject copy config/webpack/persistentCache folder
May 15, 2021
9cdf282
Move tsbuildinfo into cache folder
May 15, 2021
d72116e
Update dependencies
May 15, 2021
8f81bc7
Update webpack-dev-server to beta.3
May 15, 2021
b7f1f2f
Compilation.modules changed to type Set
May 15, 2021
5b35c42
Merge remote-tracking branch 'upstream/master' into webpack5-update
May 15, 2021
c2dbf96
Format JsonInclusion.js using prettier
May 15, 2021
35df374
Run prettier on webpack dev server config
May 15, 2021
2504864
Enable e2e behavior tests using node 12+14
May 15, 2021
8976811
Comment out e2e behavior tests for now
May 15, 2021
8fdc63b
Add experimental support for module federation
May 15, 2021
28aa672
Fix missing wds socket path update
May 18, 2021
c7c916e
Revert "Add experimental support for module federation"
May 18, 2021
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
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"browser": true,
"commonjs": true,
"node": true,
"es6": true
"es6": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2018
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Integration Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
job:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
node: ['10', '12', '14']
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Cache dependencies
id: cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', './yarn.lock') }}
- name: Install packages
if: steps.cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile --prefer-offline
- name: Run integration tests
run: yarn test:integration
2 changes: 1 addition & 1 deletion docusaurus/docs/using-the-public-folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The `public` folder is useful as a workaround for a number of less common cases:

- You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest).
- You have thousands of images and need to dynamically reference their paths.
- You want to include a small script like [`pace.js`](https://github.hubspot.com/pace/docs/welcome/) outside of the bundled code.
- You want to include a small script like [`pace.js`](https://github.com/CodeByZach/pace) outside of the bundled code.
- Some libraries may be incompatible with webpack and you have no other option but to include it as a `<script>` tag.

Note that if you add a `<script>` that declares global variables, you should read the topic [Using Global Variables](using-global-variables.md) in the next section which explains how to reference them.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"screencast": "node ./tasks/screencast.js",
"screencast:error": "svg-term --cast jyu19xGl88FQ3poMY8Hbmfw8y --out screencast-error.svg --window --at 12000 --no-cursor",
"alex": "alex .",
"test:integration": "jest test/integration",
"test": "cd packages/react-scripts && node bin/react-scripts.js test",
"format": "prettier --write 'packages/*/*.js' 'packages/*/!(node_modules)/**/*.js'",
"compile:lockfile": "node tasks/compile-lockfile.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-react-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This config also ships with optional Jest rules for ESLint (based on [`eslint-pl
You'll first need to add the ESLint plugin for Jest (if you don't already have it installed).

```sh
npm install --save-dev eslint-plugin-jest@^24.0.0 eslint-plugin-testing-library&^3.9.0
npm install --save-dev eslint-plugin-jest@^24.0.0 eslint-plugin-testing-library@^3.9.0
```

You can then enable these rules by adding the Jest config to the `extends` array in your ESLint config.
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"global-modules": "2.0.0",
"globby": "11.0.1",
"gzip-size": "5.1.1",
"immer": "8.0.1",
"immer": "8.0.4",
"is-root": "2.1.0",
"loader-utils": "2.0.0",
"open": "^7.0.2",
Expand Down
90 changes: 90 additions & 0 deletions test/integration/create-react-app/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
'use strict';

const execa = require('execa');
const { mkdirp, remove, writeFileSync } = require('fs-extra');
const { join } = require('path');

const cli = require.resolve('create-react-app/index.js');

jest.setTimeout(1000 * 60 * 5);

const projectName = 'test-app';
const genPath = join(__dirname, projectName);

const generatedFiles = ['.gitignore', 'package.json', 'src', 'yarn.lock'];

beforeEach(() => remove(genPath));
afterAll(() => remove(genPath));

const run = (args, options) => execa('node', [cli].concat(args), options);

describe('create-react-app', () => {
it('asks to supply an argument if none supplied', async () => {
const { stderr } = await run([], { reject: false });
expect(stderr).toContain('Please specify the project directory');
});

it('creates a project on supplying a name as the argument', async () => {
await run([projectName], { cwd: __dirname });

// Assert for the generated files
generatedFiles.forEach(file => expect(join(genPath, file)).toBeTruthy());
});

it('warns about conflicting files in path', async () => {
// Create the temporary directory
await mkdirp(genPath);

// Create a package.json file
const pkgJson = join(genPath, 'package.json');
writeFileSync(pkgJson, '{ "foo": "bar" }');

const { stdout } = await run([projectName], {
cwd: __dirname,
reject: false,
});

// Assert for the expected message
expect(stdout).toContain(
`The directory ${projectName} contains files that could conflict`
);
});

it('creates a project in the current directory', async () => {
// Create temporary directory
await mkdirp(genPath);

// Create a project in the current directory
await run(['.'], { cwd: genPath });

// Assert for the generated files
generatedFiles.forEach(file => expect(join(genPath, file)).toBeTruthy());
});

it('uses npm as the package manager', async () => {
await run([projectName, '--use-npm'], {
cwd: __dirname,
});

// Assert for the generated files
const generatedFilesWithNpm = [
...generatedFiles.filter(file => file !== 'yarn.lock'),
'package-lock.json',
];

generatedFilesWithNpm.forEach(file =>
expect(join(genPath, file)).toBeTruthy()
);
});

it('creates a project based on the typescript template', async () => {
await run([projectName, '--template', 'typescript'], {
cwd: __dirname,
});

// Assert for the generated files
[...generatedFiles, 'tsconfig.json'].forEach(file =>
expect(join(genPath, file)).toBeTruthy()
);
});
});