Commit graph

119 commits

Author SHA1 Message Date
Joe Haddad
47ec677127
chore: compile css-loader (#21357)
This PR compiles `css-loader` to resolve a peer dep warning.
2021-01-20 05:47:25 +00:00
Joe Haddad
ab158c0aee
chore: compile resolve-url-loader (#21351)
Closes #21166
2021-01-19 20:08:24 +00:00
Guy Bedford
005a8abe39
feat: Webpack loader inlining (#21127)
This picks up on the inlining work in https://github.com/vercel/next.js/pull/20598 to also include webpack loader inlining optimizations.

This includes:
* The dependencies of sass-loader
* resolve-url-loader

And for added benefit:
* babel-plugin-transform-define
* babel-plugin-transform-react-remove-prop-types

style-loader and css-loader didn't inline easily. Perhaps we can come back to these ones.
2021-01-15 01:51:45 +00:00
Guy Bedford
bddb02286f
feat: webpack inlining with configuration for v4 / v5 (#20598) 2021-01-13 20:59:08 -05:00
Kristoffer K
1c75bf789b
perf(next): use require.resolve instead of resolve (#19518)
**What's the problem this PR addresses?**

- ~~https://github.com/vercel/next.js/pull/18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~
Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older node versions in https://github.com/babel/babel/pull/12439 which was upgraded in https://github.com/vercel/next.js/pull/20586
- `next` unnecessarily bundles the `resolve` package when `require.resolve` is builtin and can do the same job

**How did you fix it?**

- ~~Avoid running `resolve` through ncc~~
Added a test for https://github.com/vercel/next.js/issues/19334 (closes https://github.com/vercel/next.js/issues/19334)
- Replace `resolve` with `require.resolve`
2021-01-11 14:43:08 +00:00
Tim Neutkens
5c5108fe0d
Add profiling to webpack loaders (#20392)
Follow-up to #20357 with additional tracers.
2020-12-29 21:21:35 +00:00
Joe Haddad
52270af307
Remove unnecessary unfetch polyfill for dev (#20589)
Fetch is always polyfilled in legacy browsers by `@next/polyfill-nomodule`, so we do not need to import unfetch for IE11 support.

Fixes #20588
2020-12-29 21:01:42 +00:00
Tim Neutkens
81e67ce95e
Update terser-webpack-plugin to support webpack 4 (#20089)
Solves some of the cache warnings when using webpack 5
2020-12-12 20:28:53 +00:00
JJ Kasper
00f8297c4d
Fix prefetching in IE11 (#19171)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-11-15 16:18:16 -05:00
Joe Haddad
61c3db7368
Fix minifying inline CSS comments (#19167)
We accidentally regressed back in 9.5 and dropped support for inline CSS comments. PostCSS always parses these as pass-through (and not a syntax error), which can cause problems when minifying.

Browsers do a similar thing and ignore the comments.

To ensure we generate valid CSS, this adds support for stripping the CSS comments from the build.

--- 

Fixes #15589
Closes #17130
2020-11-14 15:03:04 +00:00
JJ Kasper
f02f70478b
Ensure correct target is used for ncc'ing web-vitals (#18905)
This makes sure we don't use es6 syntax when compiling the `web-vitals` package with `ncc` since that breaks IE11 compatibility 

x-ref: https://github.com/vercel/ncc/pull/614
2020-11-06 21:02:28 +00:00
Guy Bedford
8221c180a5
ncc 0.25.0 upgrade and fixes (#18873)
This upgrades to ncc@0.25.0 and fixes the previous bugs including:

* ncc not referenced correctly in build
* Babel type errors
* node-fetch, etag, chalk and raw-body dependencies not building with ncc - these have been "un-ncc'd" for now. As they are relatively small dependencies, this doesn't seem too much of an issue and we can follow up in the tracking ncc issue at https://github.com/vercel/ncc/issues/612.
* `yarn dev` issues

Took a lot of bisecting, but the overall diff isn't too bad here in the end.
2020-11-06 02:33:14 +00:00
Guy Bedford
4dbb65d0f1
yarn dev regression fix, ncc revert (#18861)
This fixes the current regression with an ncc revert for now.

I will continue to follow up with the ncc upgrade in https://github.com/vercel/next.js/pull/18860.
2020-11-06 00:47:31 +00:00
Guy Bedford
64850a8348
ncc Babel inlining (#18768)
This adds inlining for Babel and the Babel plugins used in next.

This is based to the PR at https://github.com/vercel/next.js/pull/18823.

The approach is to make one large bundle and then separate out the individual packages from that in order to avoid duplications.

In the first attempt the Babel bundle size was 10MB... using "resolutions" in the Yarn workspace to reduce the duplicated packages this was brought down to a 2.8MB bundle for Babel and all the used plugins which is exactly the expected file size here.

This will thus add a 2.8MB download size to the next package, but save downloading any babel dependencies separately, removing a large number of package dependencies from the overall install.
2020-11-05 14:23:01 +00:00
Guy Bedford
8f7f1018d2
ncc inlining optimizations (#18752)
This adds ncc inlining optimizations for the following dependencies:

* cacache
* schema-utils
* find-cache-dir
* mkdirp
* neo-async
* web-vitals

The slight increase in output in the reports here is due to the variation of the bundled version of web-vitals.

In addition, this moves ast-types to be a devDependencies entry instead of in dependencies as it was before https://github.com/vercel/next.js/pull/14746 as I could not see any production usage (ping @prateekbh). Happy to separate that out into a separate PR if preferred too.
2020-11-04 21:52:49 +00:00
JJ Kasper
bbdebd4f57
Make sure animated assets aren't de-animated by optimizer (#17974)
This makes sure the image optimizer doesn't de-animate images by transforming them with sharp since sharp doesn't currently handle outputting animated images

x-ref: https://github.com/vercel/next.js/pull/17749
2020-10-17 19:22:10 +00:00
JJ Kasper
ad22e77309
Expose dotenv loading under separate package (#17152)
* Expose dotenv loading under separate package

* Update pre-compiled

* Rename package to @next/env

* Update lint ignores

* Update package.json

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-09-25 13:14:28 -05:00
Joe Haddad
49a59b1ad2
Polyfill missing std lib fns for module browsers (#17083) 2020-09-14 15:25:30 -04:00
Joe Haddad
33176806f3
Remove unused dependency (#16168) 2020-08-13 13:40:08 -04:00
Joe Haddad
e08b633c3a
Do not bundle caniuse-lite (#16048) 2020-08-10 11:27:21 -04:00
Joe Haddad
882288b532
Warn when Fast Refresh is disabled (React <16.10) (#15931) 2020-08-06 10:41:11 -04:00
Tim Neutkens
c5cc6072d0
Use single webpack runtimeChunk for Node.js compilation (#14722)
Webpack 5 supports a single runtimechunk for the Node.js compilation, this solves sharing modules between entrypoints.
2020-07-01 15:34:00 +00:00
Joe Haddad
923afd68d4
Upgrade CSSNano Version (#14638)
Fixes #14632
Fixes #14690
2020-06-29 21:29:53 +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
JJ Kasper
ad2c1a8a16
Make sure to watch all next-server files (#14023)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-10 11:27:37 -05:00
Tim Neutkens
2920af7cd3
Combine taskr next-server tasks into one (#13842)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-08 21:32:09 -04:00
Tim Neutkens
0fc344e6a3
Remove unused variable (#13716)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-03 11:58:58 -04: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
bee8c31b87
Lint for invalid imports (#13482)
This adds a lint rule to ensure we don't import dev dependencies by accident.
2020-05-28 08:23:10 +00:00
Joe Haddad
37f4353f24
Do not throw away tsconfig.json comments (#13458)
This pull request updates our TypeScript verification process to not wipe out potentially vital user comments.

Introducing a prompt process was mostly a side effect of users wanting to keep comments.
There's no reason we really need this prompt, as answering no would refuse to boot the Next.js server anyway.

---

Fixes #8128
Closes #11440
2020-05-27 18:46:18 +00:00
Tim Neutkens
9b098f549a
Add sourcemaps to Next.js core compilation (#13049)
* Generate sourcemaps for core files that pass through Babel

* Run files through Babel instead of tsc

* Get rid of wildcard helper

* Get rid of wildcard helper

* Remove unused file

* Update wildcard imports

* Add exclude

* Get rid of object-assign helper

* Use Object.assign as it gives better output

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-05-19 09:09:59 +02:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Joe Haddad
0d49f22e11
Remove react-error-overlay (#12942) 2020-05-15 14:14:44 -04:00
Shu Uesugi
cc139b8d89
More renaming ZEIT → Vercel (#12649) 2020-05-09 17:21:53 +02:00
Tim Neutkens
0713ba4e78
Fix wildcard paths causing infinite resolving (#12318) 2020-04-29 17:04:42 +02: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
84b89c8b24
Pre-ncc compiled packages to prevent re-nccing unnecessarily (#11569)
* Pre-ncc compiled packages to prevent re-nccing unnecessarily

* Add compiled files

* Re-run pre-ncc step

* Add check to workflow to ensure pre-compiled doesnt need updating

* Update check-pre-compiled script

* Add handling for lower case license while nccing

* bump

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-04-07 09:42:16 -04:00
Guy Bedford
755dc40969 postcss loaders 2020-03-30 16:26:25 -04:00
Guy Bedford
a3ec26d30a ignore-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
8dad5abd66 file-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
c855a3828e babel-loader, cache-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
84a46dfb8c thread-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
40f6bdef32 autodll-webpack-plugin 2020-03-30 16:26:25 -04:00
Guy Bedford
8b1ea308c6 webpack-dev-middleware, webpack-hot-middleware 2020-03-30 16:26:25 -04:00
Guy Bedford
3621a5d515 Revert "@ampproject/toolbox-optimizer"
This reverts commit 4a7afb72b8c328057bd50b86de92c1abb8d8afc3.
2020-03-30 16:26:25 -04:00
Guy Bedford
278fd54ef1 @ampproject/toolbox-optimizer 2020-03-30 16:26:25 -04:00
Guy Bedford
35a6710cdb babel revert 2020-03-30 16:26:25 -04:00
Guy Bedford
d76844082b react-error-overlay 2020-03-30 16:26:25 -04:00
Guy Bedford
c16f60067b path-to-regexp 2020-03-30 16:26:25 -04:00
Guy Bedford
8c21494997 polyfills 2020-03-30 16:26:25 -04:00