Commit graph

113 commits

Author SHA1 Message Date
JJ Kasper
80210bc31a Update removing AMP pages to not require during build (#7081)
* Update to use babel plugin with webpack plugin to
remove AMP client bundles since they are not used

* Remove acorn dependency since it isn't used
2019-04-22 06:25:17 +09:00
Connor Davis
f8978cc29c Detect built ins in externals (#7083) 2019-04-20 10:44:39 +09:00
Joe Haddad
35236690c0
Disable Terser loader when debugging (#7079) 2019-04-19 13:26:30 +09:00
JJ Kasper
6f9c3aa839 Remove experimental amp config (#7046)
This just removes the need for setting the experimental amp option
2019-04-16 22:09:57 +09:00
Joe Haddad
8b136a6f9d
Add experimental option to enable terser loader (#7033) 2019-04-15 20:00:01 +09:00
JJ Kasper
cf889d6094 Re-add experimental amp config (#7030)
* Update amphtml and canonical rels, put amp behind
experimental flag again, and update checking for amp query

* Fix typescript error

* Re-add flag to next.config.js
2019-04-15 18:26:23 +09:00
Joe Haddad
74cb4f4b7b
Switch to using .next/cache for flying shuttle and terser (#7013) 2019-04-11 17:09:12 -04:00
Joe Haddad
cc09478a7b Disable terser on .min.js input files (#7008)
This skips re-compressing already minified files.
2019-04-11 17:33:30 +02:00
JJ Kasper
4b9b2fb3a5 Make async-to-promises babel plugin experimental (#7006)
* Make async-to-promises babel plugin experimental

* Move excludes for asyncToPromises behind flag too

* Move other configs behind flag

* Re-add original exclude item
2019-04-11 10:28:57 -04:00
JJ Kasper
711d45b698 Use next.config env and packages to calculate hashes (#7001)
* Use next.config env and packages to calculate
hashes for chunk-graph

* Remove example from testing

* remove left over import

* Tweak behavior
2019-04-10 15:19:50 -04:00
Joe Haddad
a1598b5285
Disable recordsPath for selective page building (#6997)
We cannot rely on `recordsPath` when using selective page mode. All modules must be identified.
2019-04-10 12:23:16 -04:00
Joe Haddad
1810cf5abe
Add an experimental mode for flyingShuttle (#6985) 2019-04-09 22:05:40 -04:00
Luis Fernando Alvarez D
a5ad06f99b
the externals option is undefined for client builds (#6983) 2019-04-09 19:10:18 -05:00
Joe Haddad
ca565fc6e4
Adjust flying shuttle minify (#6980)
* Disable Terser plugin when using flying shuttle

* Add a new minify loader

* Downgrade terser

* Turn on minify loader

* Only compress source / mangle output
2019-04-09 15:13:25 -04:00
Luis Fernando Alvarez D
653f0a2a88 Disabled the checkWasmTypes config in webpack (#6978)
* Disabled the checkWasmTypes config in webpack

* Typescripted
2019-04-09 15:09:20 -04:00
Luis Fernando Alvarez D
72a31cb438
Disabled performance config in webpack (#6976) 2019-04-09 12:43:24 -05:00
Luis Fernando Alvarez D
75a6ef0646 Moved NODE_ENV to our config (#6965)
Closes #6943
2019-04-09 15:16:27 +02:00
Tim Neutkens
35bbe30912
Optimize resolve configuration (#6954)
* Resolve Next.js loaders first

Next.js loaders should be resolved first, then node_modules. There is no need for NEXT_PROJECT_ROOT_NODE_MODULES anymore since all our loaders are internal

* Move wasm to end of array

Since wasm isn’t the main target for Next.js it makes no sense to try and resolve it as the first value, as it would incur a file not found for nearly all files in the compilation
2019-04-08 14:57:21 +02:00
Tim Neutkens
7b64381151
Disable terser for server build (#6951)
Checking the stats first. But at least until https://github.com/zeit/next.js/issues/6950 is figured out we should disable it for serverless builds as it's also disabled for zeit.co serverless builds.
2019-04-08 14:06:04 +02:00
Tim Neutkens
da02f57054
use var as libraryTarget (#6945)
By using `var` we opt-out of the LibraryTemplatePlugin. Considering we have our own loader for registering pages this makes sense.
2019-04-08 11:14:51 +02:00
Joe Haddad
bbfc0f8207
Add more chunk graph data (#6911)
* Fix nested position

* Drop front commit

* Emit new page chunks key with all involved files for a page
2019-04-05 16:25:24 -04:00
Joe Haddad
bb4ecfb639 Revert "Extract styled-jsx (#6901)" (#6907)
This reverts commit 5dc9f55e94.
2019-04-05 17:13:06 +02:00
Joe Haddad
3e5adfee24
Turn off module opts when selective page building (#6903) 2019-04-05 00:29:10 -04:00
Joe Haddad
5dc9f55e94
Extract styled-jsx (#6901) 2019-04-04 21:59:49 -04:00
Joe Haddad
e7ca6aa45e
Correctly compute unknown module ids (#6898) 2019-04-04 20:41:07 -04:00
Joe Haddad
30fe5fc16d
Compute Chunk Graph file hashes on emit (#6897)
* Compute hashes of files during emit

* Fix tests

* Remove test from old location

* Correct the target
2019-04-04 18:00:04 -04:00
Joe Haddad
19c635175b
Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages

* Add code VSCode deleted

* Add dynamicBuildId option to __NEXT_DATA__

* Reduce amount of diff

* Make getPageFile code easier to read

* Minimize diff

* minimize diff

* Fix default value for dynamicBuildId

* Fix weird bug

* Fetch the head build id on client

* Move __selectivePageBuilding

* Add tests

* Remove _this

* Add console warning
2019-04-04 17:54:01 -04:00
Connor Davis
899f21ff9b
Dont prefetch with debug mode (#6895) 2019-04-04 15:17:00 -05:00
Joe Haddad
ba09c5948e
Set buildId to a fixed value during debug build (#6886)
* Set buildId to a fixed value during debug build

* __debug => debug
2019-04-03 19:43:48 -04:00
Joe Haddad
d653216208
Add an experimental debug mode to builds (#6870)
* Add a debug mode to webpack configuration

* Undo debug change for dist dir
2019-04-02 21:19:08 -04:00
Joe Haddad
a63a493346
Refine selective page building (#6866) 2019-04-02 20:22:04 -04:00
Joe Haddad
4201fb957d
Emit manifest of all page files (#6853)
* Get all modules included in build

* Add tests

* Get all modules contained per entry chunk

* Sort files

* Add specialized page entry to manifest

* Split manifest into pages and chunks key

* Update test

* Use relative paths to build directory

* Update test
2019-04-02 15:48:05 -04:00
JJ Kasper
6344c5f0c1
Add optimizing AMP pages (#6835)
* Added amp-toolbox-optimizer and added
optimizing AMP pages as dirty and clean

* Fix amp-optimizer breaking serverless build

* Exclude amp-toolbox-optimizer from serverless build

* Added check to make sure hybrid AMP pages
optimize cleanly during export

* Add check to make sure noDirtyAmp is applied
2019-04-02 13:01:34 -05:00
Tim Neutkens
b1fdffec75
amp-bind data injection (#6840) 2019-04-02 16:09:34 +02:00
Joe Haddad
b835e2589d
Specified page builds (#6796)
* [wip] individual page builds

* Make flag experimental and remove from main bin

* Do not split chunks when using shared runtime
2019-03-27 11:51:05 -04:00
Joe Haddad
0249b331c2
Use a shared module cache (#6791)
* [WIP] Use a shared module cache

* ID modules in development

* Revert "ID modules in development"

This reverts commit 0613d92fa2c8c7fa11a5ff5b7770d784af1cec63.

* Remove context replacement

* Only enable shared runtime in prod

* Sort settings

* Add shared runtime experimental setting

* only enable shared runtime in serverless
2019-03-26 12:30:31 -04:00
Joe Haddad
8c175e5daa Replace buildId well known string during output (#6782)
* Replace buildId well known string during output

* Fix linting
2019-03-25 17:06:00 +01:00
Tim Neutkens
907dd27a88
Make main.js override work correctly (#6781) 2019-03-25 15:08:02 +01:00
Tim Neutkens
3e7b932b2b
ncc resolve and arg (#6771)
More modules to follow.
2019-03-24 23:38:03 +01:00
Tim Neutkens
f639becf88
Don't use array for main chunk (#6767)
* Simplify getDisplayName

* Don’t use array for single file

* Add aliases, drop htmlescape as it’s not longer in the codebase

* Add correct path

* Use the correct router

* Remove dynamic for now

* Mark as external as the modules are directly called

* Add comment explaining what this does
2019-03-24 14:33:10 +01:00
Tim Neutkens
eb28d4cdcf
Remove hoist-non-react-statics from with-router (#6765)
* Remove hoist-non-react-statics from with-router

* Drop hoist-non-react-statics from package.json
2019-03-23 21:31:44 +01:00
JJ Kasper
a6ddaefe22 Add experimental exportTrailingSlash config (#6664)
By default when `next export`ing a Next.js application we will automatically append a `/` to all urls to be fully compatible with the directory structure being output.

However since most platforms support directory indexes it makes sense to change this default in the future.

This PR adds `exportTrailingSlash` as experimental flag. We'll try this out for a bit on nextjs.org / zeit.co/docs before introducing it as new option.

The default value is `true` as this is the current behavior in stable Next.js.

```
{
  experimental: {
    exportTrailingSlash: false
  }
}
```

⚠️ as with all experimental flags being added this is subject to breaking between canary/stable versions.
2019-03-17 00:54:58 +01:00
JJ Kasper
c81bd27587 Fix relative next path not working in webpack config (#6667)
* Fix relative next path not working in
webpack config

* Also add relative fix to amp path
2019-03-15 00:09:00 -04:00
Joe Haddad
0ae34c9a9d
Use relative instead of absolute for entry paths (#6659) 2019-03-14 21:45:50 -04:00
Joe Haddad
6902afbd3f
Stabilize Chunk ID generation (#6663)
* Add a new field to webpack types

* Revert "Add a new field to webpack types"

This reverts commit d35fa02207fbfd0085da0fc56aac42c4ff7c34c9.

* Add HashedChunkIdsPlugin to make consistent chunk ids

* Revert "Revert "Add a new field to webpack types""

This reverts commit 338219049e1432038f90c91928b010bbb1267999.

* Make it optional

* Remove record ids

* Revert "Remove record ids"

This reverts commit 15c22dbcda72466c382397c91d02295620f62326.
2019-03-14 21:38:57 -04:00
Joe Haddad
1fb1b75216
Ensure all modules are identified (#6656)
* Ensure all modules are identified

* Extend a webpack Plugin

Co-Authored-By: Timer <timer150@gmail.com>
2019-03-14 11:04:08 -04:00
Joe Haddad
e5636dcdb0
Inject the build ID after webpack runs (#6618)
* Inject the build ID after webpack runs

* add webpack sources types

* use webpack plugin instead

* reset file

* Skip source maps if none were provided

Co-Authored-By: Timer <timer150@gmail.com>
2019-03-12 16:39:44 -04:00
Tim Neutkens
8cf6ef58f0
Remove unused dev option from babel-loader (#6624) 2019-03-12 15:19:08 +01:00
Tim Neutkens
b32e65a830 Add experimental profiling flag (#6594)
* Add experimental profiling flag

* Update config.js
2019-03-11 13:53:24 -04:00
JJ Kasper
852a62bf56 Add experimental cpus config and use CircleCI env var (#6604)
* Add using CircleCI env var for max workers
and expose webpack to config

* Expose experimental cpu config

* Fix typo

* Remove log
2019-03-11 17:33:30 +01:00
Joe Haddad
041be6f4aa Disable webpack minifier (#6603)
When the webpack `mode` is set to `production`, `minimizer: undefined` means "use the default webpack minifier."

We need to explicitly disable the webpack minifier via `minimize: false`. This should speed up non-serverless builds. 😄 

This doesn't affect dev, but I added the toggle there for consistency.
2019-03-11 15:51:23 +01:00
Tim Neutkens
8ffcb3f3e7 Don’t load dev plugins for production bootup (#6589)
* Don’t load autodll-webpack-plugin for production bootup

* Only require autodll when client-side compilation is ran

* Try to fix build
2019-03-09 23:27:33 -05:00
Tim Neutkens
e8095c0e2e Remove cjs file (#6590) 2019-03-09 22:34:27 -05:00
Tim Neutkens
dd60199cec
Remove case-sensitive-paths-plugin (#6587)
While this is a nice feature it does filesystem operations to check if the resolved file matches the filesystem.
2019-03-10 01:44:51 +01:00
k-kawakami
d9060f5abd Remove trailing spaces (#6547)
### changes
#### remove trailing spaces

When I was using example I noticed trailing spaces.
So, this PR removes the trailing spaces of json file, README, and others.

`examples/with-jest-typescript/src/modules/cars/Overview.tsx` also has it, but this time it did not change as tslint error occurs at commit.
2019-03-07 17:40:08 +01:00
Tim Neutkens
9b62f208bb
Remove cacheKeys option and improve filtering (#6559)
More cleanup of terser-plugin.
2019-03-07 14:28:32 +01:00
Tim Neutkens
8eb813a640
await config (#6488)
* await config

* update config-promise-error test

* Actually update test
2019-03-01 01:09:07 +01:00
JJ Kasper
8ae1cd35bd Fix dynamic require breaking after updating to v8 (#6475)
* Fix dynamic require breaking after updating to v8

* Add test for dynamic require
2019-02-28 14:41:54 +01:00
JJ Kasper
1c1d5d01f8 Throw error when Promise is returned in next.config (#6476)
After discussion, it was decided we should throw an error when a promise is returned in `next.config.js` as this isn't supported

Fixes: #6416
2019-02-28 14:39:51 +01:00
JJ Kasper
256970ac75 Remove next-to-next-server babel plugin (#6458)
After discussion it was decided instead of rewriting `next/config` and `next/head` imports to `next-server/config` and `next-server/head` we should just allow importing them as `next/config` and `next/head`
 
Fixes: #6187
2019-02-27 11:00:02 +01:00
Tim Neutkens
9247c90177
Remove http-status dependency (#6405) 2019-02-22 16:25:11 +01:00
Tim Neutkens
d14d1704cb
Remove ansi-html dep (#6394)
It's not needed since we use react-error-overlay for webpack errors.
2019-02-22 00:12:47 +01:00
Connor Davis
61de215e04
Move webpack config to TypeScript (#6348) 2019-02-20 13:24:02 -06:00
Renamed from packages/next/build/webpack-config.js (Browse further)