1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

414 commits

Author SHA1 Message Date
Tim Neutkens 0107051eaa
Set default for serverRuntimeConfig (#3938) 2018-03-05 14:00:29 +01:00
Tim Neutkens 802e879d33
Implement new next/config keys (#3909) 2018-02-27 17:50:14 +01:00
Tim Neutkens 1aade36f13
Exposing configuration to the server / client side (minor) (#3882)
* Add next/config

* Set config on server start / client render

* Add documentation for next/config

* Add next/config support for next export

* Fix test

* Use the correct name

* Set default to empty object on the client side

* Add config tests

* Rename config to runtimeConfig
2018-02-26 12:03:27 +01:00
Arunoda Susiripala 77c8677e58
Fix SSR error handling in the global scope (#3877)
* Fix SSR error handling.

* Remove unwanted console.logs

* Fix a typo.

* Fix current tests.

* Add a new test case for this case.

* Error should only be logged if it is not a 404
2018-02-24 18:49:08 +05:30
Tim Neutkens 5017f91d23 Allow next.config.js to export a function (#3867)
* Allow next.config.js to export a function

* Expose phases to the configuration function

* Use same value as variable name

* Add next/constants

* Add documentation for config function / phases

* Add constants.js to npm bundle
2018-02-23 19:12:06 +05:30
Arunoda Susiripala a32b22bb2d
Remove special error script handling (#3849)
* Remove special error script handling.
As a result of that, we can't detect 500 errors and buildIdMismatch via client side.

* Fix failing test cases.

* Refactor the code base.

* Remove Router.onAppUpdated
2018-02-21 23:11:25 +05:30
Olivier Tassinari 832425e67e fix w3c warnings (#3572) 2018-02-21 18:45:51 +05:30
Arunoda Susiripala 9cfea69ab1 [SSR] Use relative paths in dynamic import output code (#3844)
* [SSR] Use relative paths in dynamic import output code
Now we use relative paths in the output code of dynamic import
in the server side.

* Remove unwanted constructor.
2018-02-19 11:49:41 +01:00
Tim Neutkens c204cdd91e Read compiler.context instead of this.context (#3839) 2018-02-19 13:19:59 +05:30
Tim Neutkens 7e756ee5d9
Expose totalPages to the webpack decorator (#3824) 2018-02-17 12:37:33 +01:00
thom 07af67bfea Allow page extensions in any order (#3827) 2018-02-17 12:36:47 +01:00
Jerome Fitzgerald c92bc858f7 [refactor] poweredByHeader (#3716) (#3807)
This reverts `fb7c862` per @timneutkens

- Removes the errors/*.md associated
- Puts back `poweredByHeader` for `next.config.js`
- Reincorporates test:

X-Powered-By header
    ✓ should set it by default (3ms)
    ✓ should not set it when poweredByHeader==false (5ms)

Also tested with `yarn link` and verified.
2018-02-14 18:02:48 +01:00
Tim Neutkens 903f15acc4 Make pageExtensions configurable (#3787)
* Make page require faster

* Add windows search/replace

* Use normalize instead of resolve

* Add remaining tests

* Use sep instead of /

* Add test files

* Make component require faster

* Add console.error

* Make pageExtensions configurable

* Remove resolve.js

* Add test for `.jsx`

* Also resolve `/nav/index` and the likes

* Normalize page paths

* Use config passed off by webpack
2018-02-14 20:50:41 +05:30
Tim Neutkens 64379ee342 Get config from one location (#3801)
* Remove obsolete clean.js

* Remove unused root-module-relative-path

* Single source of configuration

* Fix next export
2018-02-14 20:47:41 +05:30
Arunoda Susiripala fc3b3a4101 Implement proper error handling (#3749)
* Render error on the client without fetching additional scripts.

* Fix test cases.

* Remove unused '_document' page in ensurePage logic

* Remove console.error when page is not found
2018-02-13 16:13:22 +01:00
Tim Neutkens c8da345765
Make page require faster (#3776)
* Make page require faster

* Add windows search/replace

* Use normalize instead of resolve

* Add remaining tests

* Use sep instead of /

* Add test files

* Make component require faster

* Add console.error
2018-02-13 14:27:52 +01:00
Tim Neutkens 53cb345d4c Don’t quote automatically quoted string 2018-02-09 22:19:08 +01:00
Tim Neutkens ab43e9efc5 Load pathname correctly 2018-02-09 21:51:57 +01:00
Tim Neutkens 856700d576 Register the right path 2018-02-09 21:24:50 +01:00
Tim Neutkens 9a10461150 Don’t include script that we know is going to error (#3747)
* Don’t include script that we know is going to error

* Add check to make sure page script is not included

* Loop over script tags, cheerio fails on /
2018-02-09 21:25:45 +05:30
Arunoda Susiripala efe9afb2be
Remove aliasing of react and react-dom (#3731)
* Remove aliasing of react and react-dom
We need that functionality, but React does it automatically.
So, we don't need to do that.
This also fixes #3711 otherwise we need to add a few more aliases.

* Revert "Remove aliasing of react and react-dom"

This reverts commit 929d9567bbdc3f369f13888e846e848a25c9c261.

* Allow to import modules like 'react-dom/server'.
We do this by doing an extact match for 'react' and 'react-dom'
2018-02-08 14:21:01 +05:30
Scott Polhemus d015bac65f Copy static assets from .next folder when exporting (#3719)
* Copy .next/static directory when exporting

* Use nextDir
2018-02-07 16:24:07 +05:30
Martin Groen 955cc82736 Serve static /_next/static/* relative from dir directory (#3722) 2018-02-07 14:05:35 +05:30
Tim Neutkens f9b52cfcb6 Include next/dist/pages instead of exclude (patch) (#3704)
* Move security related test cases into a its own file.

* Removes the unused renderScript function

* Add a nerv example. (#3573)

* Add a nerv example.

* Fix for indentation/style

* Fix for name

* Release 5.0.0

* Add multi-zones docs. (#3688)

* Include next/dist/pages

* Fix linting
2018-02-06 17:39:41 +05:30
Bertrand Marron 8942d20b8c Move react{-dom,} to the common chunk in production too (#3690)
Without this, react-dom gets included in multiple pages.
2018-02-06 14:38:53 +05:30
Arunoda Susiripala 8308a33c11
Revert "Require files directly instead of resolving them (#3683)" (#3684)
This reverts commit fa03f0b9cc.
2018-02-05 23:16:36 +05:30
Tim Neutkens fa03f0b9cc Require files directly instead of resolving them (#3683) 2018-02-05 23:10:09 +05:30
Tim Neutkens cdbbe928b2 Add update notifier (#3678)
* Add update notifier

* Make update notifier work with custom server
2018-02-05 18:09:32 +05:30
Arunoda Susiripala 863d4d3b4f Make sure externals logic works on Windows. (#3677) 2018-02-05 09:10:55 +01:00
Arunoda Susiripala 373661aafa Handle empty assetPrefix scenario properly. (#3667)
Also make sure to init assetPrefix in next/asset in
the context of next-export.
2018-02-03 17:12:01 +01:00
Arunoda Susiripala 60cb06c1ba Improved next/asset support (#3664)
* Allow next/asset to work properly with dynamic assetPrefix
Now we use webpack's publicPath via client side.

* Add test cases for dynamic assetPrefix and next/asset.
2018-02-02 21:09:24 +01:00
Arunoda Susiripala 4c7f6cc76a Set assetPrefix dynamically (#3661)
* Introduce the setAssetPrefix API for dynamic assetPrefix.

* Remove unwanted node_modules dir in a test dir.

* Change test main description.
2018-02-02 15:43:36 +01:00
Tim Neutkens d373b893d1
Don’t finish request when it’s already finished (#3660) 2018-02-01 23:25:30 +01:00
Arunoda Susiripala abe6e3ea47 Use a latest version of path-to-regexp for path-match (#3655)
* Use the latest path-to-regexp for path-match.

* Fix the error route resolving.

* Give proper credit to path-match

* Remove an unwanted route.

* Revert "Remove an unwanted route."

This reverts commit 523c1687da8ddd499819e70df81567ec208e5998.

* Add a comment why we need to keep _error.js route.
2018-02-01 19:54:09 +01:00
Tim Neutkens b38c05bc95
Add NODE_PATH support (#3656) 2018-02-01 16:21:18 +01:00
Tim Neutkens 7e00548b8a Disable polyfill and helpers (#3652) 2018-02-01 16:54:31 +05:30
Tim Neutkens 09500c25ff Don’t exclude webpack (#3646) 2018-02-01 15:00:52 +05:30
Arunoda Susiripala 944668c6c4 Handle page 404 properly in production. (#3648)
This is needed for multi-zones feature
2018-02-01 09:26:08 +01:00
Tim Neutkens 4db7e8fe9e Fix __route error when importing a page inside a page (#3644)
* Check if Component is defined

* Add comment

* Fix linting
2018-01-31 22:50:27 +05:30
Tim Neutkens 7b2cd84fee Check if headers are sent (#3642) 2018-01-31 18:42:21 +05:30
Luc c52a3246ae Fix server not closing properly in dev mode (issue #2540) (#3540) 2018-01-31 17:07:41 +05:30
Tim Neutkens 8a4a9a10c2 Match .js instead of not css 2018-01-31 08:50:27 +01:00
Luis Fernando Alvarez D ff3aa3ad01 ignore _document.js on windows and expand symlinks when using next export (#3637)
* next export will expand symlinks now

* Make sure next export doesn't includes _document.js in windows
2018-01-31 08:38:43 +01:00
Arunoda Susiripala 4b143fc232 Make sure dynamic imports works on Windows (#3641)
* Make sure dynamic imports works on Windows

* Fix an issue with the load test firmware.

* Fix symlink creation on Unix
2018-01-31 08:35:10 +01:00
Tim Neutkens 5818e6f781 Don’t externalize css/sass/scss/less/svg 2018-01-30 21:46:16 +01:00
Tim Neutkens e093441bad Universal Webpack (#3578)
* Speed up next build

* Document webpack config

* Speed up next build

* Remove comment

* Add comment

* Clean up rules

* Add comments

* Run in parallel

* Push plugins seperately

* Create a new chunk for react

* Don’t uglify react since it’s already uglified. Move react to commons in development

* Use the minified version directly

* Re-add globpattern

* Move loaders into a separate variable

* Add comment linking to Dan’s explanation

* Remove dot

* Add universal webpack

* Initial dev support

* Fix linting

* Add changes from Arunoda's work

* Made next dev works.
But super slow and no HMR support.

* Fix client side hot reload

* Server side hmr

* Only in dev

* Add on-demand-entries client + hot-middleware

* Add .babelrc support

* Speed up on demand entries by running in parallel

* Serve static generated files

* Add missing config in dev

* Add sass support

* Add support for .map

* Add cssloader config and fix .jsx support

* Rename

* use same defaults as css-loader. Fix linting

* Add NoEmitErrorsPlugin

* Add clientBootstrap

* Use webpackhotmiddleware on the multi compiler

* alpha.3

* Use babel 16.2.x

* Fix reloading after error

* Remove comment

* Release 5.0.0-univeral-alpha.1

* Remove check for React 16

* Release 5.0.0-universal-alpha.2

* React hot loader v4

* Use our static file rendering machanism to serve pages.
This should work well since the file path for a page is predictable.

* Release 5.0.0-universal-alpha.3

* Remove optional loaders

* Release 5.0.0-universal-alpha.4

* Remove clientBootstrap

* Remove renderScript

* Make sure pages bundles are served correctly

* Remove unused import

* Revert to using the same code as canary

* Fix hot loader

* Release 5.0.0-universal-alpha.5

* Check if externals dir exist before applying config

* Add typescript support

* Add support for transpiling certain packages in node_modules

Thanks to @giuseppeg’s work in https://github.com/zeit/next.js/pull/3319

* Add BABEL_DISABLE_CACHE support

* Make sourcemaps in production opt-in

* Revert "Add support for transpiling certain packages in node_modules"

This reverts commit d4b1d9babfb4b9ed4f4b12d56d52dee233e862da.

In favor of a better api around this.

* Support typescript through next.config.js

* Remove comments

* Bring back commons.js calculation

* Remove unused dependencies

* Move base.config.js to webpack.js

* Make sure to only invalidate webpackDevMiddleware one after other.

* Allow babel-loder caching by default.

* Add comment about preact support

* Bring back buildir replace

* Remove obsolete plugin

* Remove build replace, speed up build

* Resolve page entries like pages/day/index.js to pages/day.js

* Add componentDidCatch back

* Compile to bundles

* Use config.distDir everywhere

* Make sure the file is an array

* Remove console.log

* Apply optimization to uglifyjs

* Add comment pointing to source

* Create entries the same way in dev and production

* Remove unused and broken pagesGlobPattern

* day/index.js is automatically turned into day.js at build time

* Remove poweredByHeader option

* Load pages with the correct path.

* Release 5.0.0-universal-alpha.6

* Make sure react-dom/server can be overwritten by module-alias

* Only add react-hot-loader babel plugin in dev

* Release 5.0.0-universal-alpha.7

* Revert tests

* Release 5.0.0-universal-alpha.10

* Make sure next/head is working properly.

* Add wepack alias for 'next' back.

* Make sure overriding className in next/head works

* Alias react too

* Add missing r

* Fragment fallback has to wrap the children

* Use min.js

* Remove css.js

* Remove wallaby.js

* Release 5.0.0-universal-alpha.11

* Resolve relative to workdir instead of next

* Make sure we touch the right file

* Resolve next modules

* Remove dotjsx removal plugins since we use webpack on the server

* Revert "Resolve relative to workdir instead of next"

This reverts commit a13f3e4ab565df9e2c9a3dfc8eb4009c0c2e02ed.

* Externalize any locally loaded module lives outside of app dir.

* Remove server aliases

* Check node_modules reliably

* Add symlink to next for tests

* Make sure dynamic imports work locally.
This is why we need it: b545b519b2/lib/MainTemplate.js (L68)
We need to have the finally clause in the above in __webpack_require__.
webpack output option strictModuleExceptionHandling does that.

* dynmaic -> dynamic

* Remove webpack-node-externals

* Make sure dynamic imports support SSR.

* Remove css support in favor of next-css

* Make sure we load path from `/` since it’s included in the path matching

* Catch when ensurepage couldn’t be fulfilled for `.js.map`

* Register require cache flusher for both client and server

* Add comment explaining this is to facilitate hot reloading

* Only load module when needed

* Remove unused modules

* Release 5.0.0-universal-alpha.12

* Only log the `found babel` message once

* Make sure ondemand entries working correctly.
Now we are just using a single instance of OnDemandEntryHandler.

* Better sourcemaps

* Release 5.0.0-universal-alpha.13

* Lock uglify version to 1.1.6

* Release 5.0.0-universal-alpha.14

* Fix a typo.

* Introduce multi-zones support for mircofrontends

* Add section on css
2018-01-30 16:44:44 +01:00
Tim Neutkens 963695820f Make sure pages bundles are served correctly 2018-01-13 08:34:48 +01:00
Tim Neutkens bba744d3fa Merge branch 'master' into fix/canary 2018-01-13 06:33:19 +01:00
Arunoda Susiripala 0b6575b470 Use our static file rendering machanism to serve pages.
This should work well since the file path for a page is predictable.
2018-01-13 10:36:50 +05:30
Tim Neutkens e179c98aa8
Revert "remove relative path to babel-runtime (#3119)" (#3547)
This reverts commit 8eb8034236.

# Conflicts:
#	server/build/webpack.js
2018-01-08 16:44:52 +01:00