Commit graph

279 commits

Author SHA1 Message Date
Todor Totev
1aed9eaac1
Introduce react profiling production flag (#13873)
Closes [13709](https://github.com/vercel/next.js/issues/13709).

The solution works, **(tested and confirmed with true and false flags with the latest next version)** though I am quite sure this is not the most elegant and proper way to implement it. I have spent the good part of yesterday and today's morning in order to make it more generic but since it's my first time working with anything related to webpack I have struggled miserably. Last, but not least I'm unsure if this is the most proper naming for the flag.

Please, let me know what you want me to change and I'll get it done asap.
2020-06-28 11:23:29 +00:00
Tim Neutkens
ae542b8525
Use entry option instead of custom make hook (#14527)
Simplifies on-demand-entries a bit.
2020-06-26 04:26:09 +00:00
James Mosier
435bf65784
Warn/revert custom devtool in development mode (#14285)
Warn users and revert their `devtool` when they manually change the `devtool` in development mode. For this addition, I check to ensure the `devtool` is custom (i.e. different than what is set by Next) and has a value (`false` is fine as a custom `devtool`!).

As described in [this issue (13963)](https://github.com/vercel/next.js/issues/13963), changing the `devtool` in development mode can cause issues with performance.

Fixes #13963
2020-06-24 04:15:57 +00:00
Jan Potoms
574e9d285a
Remove deprecated plugin in favor of the option (#14503)
Not sure if it's still there for a reason, but from  the types for `NoEmitOnErrorsPlugin`
```js
/* @deprecated use config.optimization.noEmitOnErrors */
```
2020-06-23 17:44:51 +00:00
Tim Neutkens
be2a63238a
Webpack 5 build compat (#14498)
Initial PR to make `next build` work with webpack 5, still needs more work to make sure runtimeChunk and such are shared between pages.

- No longer needs the custom ChunkNamesPlugin as the default behavior was changed
- Dropping AMP First client page bundles is now compatible
2020-06-23 15:47:50 +00:00
Jan Potoms
2142b76e6b
Normalize trailing slashes (#13333)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-06-23 13:38:49 +02:00
Tim Neutkens
6c2ce70608
Remove buildId from server-side files (#14413)
Gets rid of the custom function for naming files by removing buildId from the file paths.
2020-06-22 21:12:36 +00:00
Tim Neutkens
bef9b56109
Update filename generation for client-side compilation (#14279)
Updates the way filenames are generated for browser compilation.
Notably:
- All entry bundles now have hashes in production, this includes pages (previously pages used a buildId in the path)
- The AmpFiles no longer depends on hardcoded bundle names, it uses the buildManifest instead (internals)
- All cases where we match the page name from the chunk/entrypoint name now use the same function `getRouteFromEntrypoint` (internals)
- In development we no longer include the "faked" `buildId` set to `development` for page files, instead we just use the `/_next/static/pages` path (was `/_next/static/development/pages`). This was changed as it caused unneeded complexity and makes generating the bundles easier (internals)
- Updated tons of tests to be more resilient to these changes by relying on the buildManifest instead of hardcoded paths (internals)

Follow up of these PRs:
https://github.com/vercel/next.js/pull/13759
https://github.com/vercel/next.js/pull/13870
https://github.com/vercel/next.js/pull/13937
https://github.com/vercel/next.js/pull/14130
https://github.com/vercel/next.js/pull/14176
https://github.com/vercel/next.js/pull/14268


Fixes #6303
Fixes #12087 
Fixes #1948
Fixes #4368
Fixes #4255
Fixes #2548
2020-06-20 19:59:47 +00:00
JJ Kasper
f92571d502
De-experimentalize basePath config (#14283)
This moves the experimental `basePath` config out of the `experimental` section to prepare it for being stable
2020-06-18 10:10:20 +00:00
Tim Neutkens
1fc0aae589
Prepare for webpack 5 upgrade (#14268)
Tweaked the config that can already be updated a bit.
2020-06-17 15:00:29 +00:00
Tim Neutkens
76fddcd7ef
Use chunkhash instead of buildId for pages (#13937)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-11 10:57:24 +02:00
Tim Neutkens
e125d905a0
Clean up render.tsx options (#13759)
Went through and removed a bunch of internal options which are just pass-through values of buildManifest

Closes #13851
2020-06-06 23:00:03 +00:00
Tim Neutkens
08e7fa16db
Get rid of autodll (#13669)
Prepares for the upgrade to webpack 5
2020-06-02 19:20:37 +00:00
Joe Haddad
a92e976231
Remove remaining granular chunks references (#13672)
This removes remaining references to `granularChunks` in configs, error messages, and comments.

Also removed the `process.env.__NEXT_GRANULAR_CHUNKS` value.

---

Follow up to: https://github.com/vercel/next.js/pull/13663
2020-06-02 14:45:07 +00:00
Tim Neutkens
0769a82acc
Remove granularChunks experimental option as it was launched (#13663)
The option was released a few months ago so we can get rid of this option.
2020-06-02 14:13:11 +00:00
Tim Neutkens
b124ed2e14
Added no-shadow rule to eslint (#13645)
Was going through _document and noticed some variable shadowing going on. Added a rule for it to our eslint configuration and went through all warnings with @Timer.
2020-06-01 21:00:22 +00:00
Joe Haddad
92a12a2e20
Replace fork-ts-checker-webpack-plugin with faster alternative (#13529)
This removes `fork-ts-checker-webpack-plugin` and instead directly calls the TypeScript API.

This is approximately 10x faster.

Base build: 7s (no TypeScript features enabled)

- `fork-ts-checker-webpack-plugin@3.1.1`: 90s, computer sounds like an airplane
- `fork-ts-checker-webpack-plugin@4.1.6`: 84s, computer did **not** sound like an airplane
- `fork-ts-checker-webpack-plugin@5.0.0-alpha.14`: 90s, regressed
- `npx tsc -p tsconfig.json --noEmit`: 12s (time: `18.57s user 0.97s system 169% cpu 11.525 total`)
- **This PR**: 22s, expected to get better when we run this as a side-car

All of these tests were run 3 times and repeat-accurate within +/- 0.5s.
2020-05-29 08:16:22 +00:00
Joe Haddad
30fbd9adc9
Speedup tests (#13461)
This PR checks if our tests can be ran faster by disabling source maps unless they're used for the purpose of testing.
2020-05-29 07:57:51 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
Joe Haddad
8b72b9e2de
[Experimental] Do not type check twice (#13419)
The experimental modern mode runs the type checking plugin twice, which **occasionally** suffers from a race condition that hangs the build.

This PR fixes type checking to only be run once.

While this test cannot 100% reproduce/capture the race condition, I don't feel strongly about the test case:

- We're planning on eliminating this type checking plugin ASAP (for a faster alternative)
- Modern mode implementation as-is will probably go away with webpack 5
2020-05-27 02:58:16 +00:00
Janicklas Ralph
a17ace8eba
GranularChunks conformance check (#11710)
Adding a conformance plugin the make sure users don't undo the benefits of the granularChunks config.

The plugin makes sure that minSize, maxInitialRequests values aren't overridden. Also ensures the cacheGroups - vendors, framework, libs, common, shared are maintained.

The warning and error messages do not break the build with this change. They only display a message.

cc - @prateekbh, @atcastle
2020-05-20 06:40:23 +00:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Joe Haddad
6d6ce94f68
An empty jsconfig.json should not fail the build (#13051) 2020-05-18 12:31:15 -04:00
Jan Potoms
3b382a08d5
Improve jsconfig.json error message (#13053) 2020-05-18 12:07:08 -04:00
Tim Neutkens
dfe6d14859
[Experimental] Add support for production browser source maps (#13018) 2020-05-17 16:30:42 -04:00
Joe Haddad
0d49f22e11
Remove react-error-overlay (#12942) 2020-05-15 14:14:44 -04:00
Joe Haddad
9c79955047
Strip out dead code for ignoreDevErrors (#12941) 2020-05-15 13:30:01 -04:00
Joe Haddad
f1423518b9
Better Babel syntax errors (#12821) 2020-05-13 11:43:41 -04:00
Tim Neutkens
467b2c7ebc
Enable sassOptions support in next.config.js (#12685) 2020-05-10 22:11:48 -04:00
Joe Haddad
f54e05f776
[Fast Refresh] Reorder Loaders (#12671) 2020-05-09 18:37:04 -04:00
JJ Kasper
92edfb953d
Cont. Update performance relayer and remove unstable prefix (#12665)
* updates relayer, uses web-vital lib, removes fid polyfill and removes unstable prefix from relayer

* simplify logic, fix null check

* update docs

* Update tests

* Rename relayWebVitals to reportWebVitals

Co-authored-by: housseindjirdeh <houssein@google.com>
2020-05-09 21:48:52 +02:00
Joe Haddad
e173967b9f
[Fast Refresh] New Compile Error Overlay (#12543) 2020-05-05 23:46:07 -04:00
Joe Haddad
48140d5bb7
Disable Comment Extraction (#12496) 2020-05-05 11:39:36 -04:00
Joe Haddad
e0449a5b9c
[Fast Refresh] New Overlay for Prerender Error (#12485) 2020-05-04 17:16:03 -04:00
Joe Haddad
fbea795ad9
[Fast Refresh] Redesigned Runtime Error Experience (#12222) 2020-04-30 10:50:25 -04:00
JJ Kasper
3094016cc3
Downgrade terser to fix invalid minifying (#12178) 2020-04-26 15:16:43 -04:00
Tim Neutkens
5d8968f64a
Remove launched experimental options (#12197) 2020-04-25 21:00:41 +02:00
Tim Neutkens
555ba60544
Run tsconfig paths resolver before PnP (#12104) 2020-04-24 15:50:36 +02:00
Joe Haddad
07b24e6fa1
Upgrade webpack (#12082)
* Upgrade webpack

* rebundle
2020-04-21 16:05:29 -04:00
JJ Kasper
4d193ea33b
Update to only apply experimental process.env stub in developm… (#12055) 2020-04-20 20:25:36 +02:00
Joe Haddad
73b859d53e
Add module.hot.invalidate() to webpack HMR (#12038) 2020-04-20 01:26:27 -04:00
Joe Haddad
450d4bd0f3
Experimental: React Refresh Support (#12008)
* Add Fast Refresh Support

* Add Basic Acceptance Test

* Increase delay

* fix version

* Ignore test files

* Update packages/next/build/webpack/loaders/next-babel-loader.js

* Copy tests

* Redo test style

* drop directory

* fix compile

* fix remove function

* Update helpers
2020-04-19 13:58:31 -04:00
Joe Haddad
4619996d4e
Resolve TypeScript Extension in Correct Order (#12014) 2020-04-19 01:12:36 -04:00
Tim Neutkens
511cf748ee
Enable "paths" support by default (#11970)
* Enable "paths" support by default

* Enable NEXT_PUBLIC_ prefix exposing the variable globally

Part of #11106
2020-04-17 16:28:17 +02:00
Tim Neutkens
29c697b36b
Add initial configuration changes for webpack 5 (#11917)
* Disable PnP plugin in webpack 5

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* Use full hashes for hot update names

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* Disable autodll in webpack 5

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* Disable HashedModuleIdsPlugin in webpack 5

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* Use regexes for ignoreplugin as it only supports regexes in webpack 5

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* webpack 4 supports resourceRegExp and contextRegExp

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* Remove webpack 4 specific properties from the webpack 5 config

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* Add library option for webpack 5 support

Co-Authored-By: Zack Jackson <zackary.l.jackson@gmail.com>

* Fix TypeScript Errors

Co-authored-by: Zack Jackson <zackary.l.jackson@gmail.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-15 14:25:02 -04:00
Joe Haddad
fe09c10383
Upgrade terser-webpack-plugin for Webpack 5 (#11922)
* Upgrade `terser-webpack-plugin` for Webpack 5

* Upgrade again

* cacache cannot be bundled

* cacache cannot be bundled

* fix file

* remove cacache dep

* Update LICENSE
2020-04-15 14:20:25 -04:00
JJ Kasper
20c7b5c50d
Add initial process.env stubbing for new env support (#11893)
* Add initial process.env stubbing for new env support

* Fix server process.env being stubbed in production

* bump

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-15 02:42:37 -04:00
JJ Kasper
2b488ab1e1
Fix NEXT_PUBLIC env values not being inlined (#11896)
* Clean up env tests a bit

* Fix NEXT_PUBLIC env values not being inlined

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-15 02:32:03 -04:00
JJ Kasper
d3e308a79f
Add basePath in link component and add/remove it consistently (#9988)
* Add basePath in link component and add/remove it consistently

* Update to not use regex for delBasePath

* Expose addBasePath as router method

* Revert "Expose addBasePath as router method"

This reverts commit 40fed596195c6affabf837e42d472452768e13a3.

* Expose basePath as router field

* Apply suggestion

* Expose basePath as router field

* remove un-used vars

* Update externals

* Apply lint fix

* Update size-limit test

* Update prefetch
2020-04-14 09:50:39 +02:00
Houssein Djirdeh
04ceba4309
Adds first input delay performance metric (#8884)
* measures fid

* updates typings, fixes logic, updates per review comments

* update to es5

* separate clearMeasures

* use relayer

* creates fid polyfll render helper + simplifies measure

* switch to dynamic import

* creates fid experimental flag

* removes unecessary time-to-first-input metric

* removes hydration measure removes

* default flag to false

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-13 14:46:46 -04:00