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

51 commits

Author SHA1 Message Date
Tim Neutkens 475b426ed1
Compile pages to .next/static directory (#4828)
* Compile pages to .next/static/<buildid>/pages/<page>

* Fix test

* Export class instead of using exports

* Use constant for static directory

* Add comment about what the middleware does
2018-07-25 13:45:42 +02:00
Tim Neutkens 75476a9136
[WIP] Webpack 4, react-error-overlay, react-loadable (#4639)
Webpack 4, react-error-overlay, react-loadable (major)
2018-07-24 11:24:40 +02:00
Tim Neutkens 85769c3d32
Pass through buildId to webpack config in development (#4665)
Fixes #4664
2018-06-25 23:06:46 +02:00
Tim Neutkens f2c2519159
Move build directory outside of server folder (#4565)
The prepares for next-server.

I also took this as an opportunity to get all build directory paths from a single location, as they were previously scattered across webpack/babel plugins and loaders.
2018-06-14 19:30:14 +02:00
Tim Neutkens cd1a2fbd91
Add check for added/deleted pages (#4497) 2018-05-29 19:32:16 +02:00
Tim Neutkens 44c7aa44c3 Make sure _document doesn’t reload the page when switching pages 2018-05-16 10:08:18 +02:00
Tim Neutkens 535bab167b
Fix double-reload / redirect when changing pages (#4388)
When changing a page `/_app` can be seen as “updated”,  but the router shouldn’t reload it, because there is an ongoing/going to be ongoing update.
2018-05-16 00:36:24 +02:00
Tim Neutkens ebf0c47c25
Upgrade standard.js (#4064)
* Upgrade standard.js

# Conflicts:
#	yarn.lock

* Upgrade babel-eslint
2018-03-27 20:11:03 +02: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
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
Arunoda Susiripala 337fb6a9aa Remove buildId from dynamic import URLs (#3498)
* Use without .js for the filename.

* Modify the chunk filename to add .js via webpack

* Add import chunk's hash to the filename via webpack.

* Remove buildId from dynamic import urls.

* Make sure next-export work with dynamic imports
2017-12-27 19:59:17 +01:00
Arunoda Susiripala 8f874f050c [WIP] Use buildId in chunk urls as well (#2873)
Use buildId in chunk urls as well
2017-08-31 05:47:06 +05:30
Ian Mitchell ac3c59b9f4 Removes Windows Webpack Polling (#2359) 2017-06-30 12:20:18 +05:30
Arunoda Susiripala 937d0e2bb6 [WIP] Reload webpack if needed (#2076)
* Reload webpack via hot-reloader when needed.
We need to do this specially we removed a previosly
built page from the filesystem.

* Make sure reloading is happen only once

* Reload only if there's a missing page error.

* Remove debug logs.

* 2.4.2

* Refactor the codebase a bit.

* Move some commonly used regexp to a utils module.

* Handle the reloading well when there's a custom error page.

* Add a HMR test case.

* Close the browser in the test case.
2017-06-06 15:32:02 -07:00
Arunoda Susiripala 24f511f343 When detecting changed pages in hot-reloader use only pages. (#2171) 2017-06-05 20:37:20 +05:30
Arunoda Susiripala 443abba94a Fix HMR http request timeout issue under node 8. (#2166)
The fix is to add a heartbeat less than 5 secs.
2017-06-05 11:02:13 +02:00
Felix-Antoine Paradis 442c611d49 Add next configuration as an option for custom servers (#2058)
* Add a configuration parameter to custom server startup

* Adding related documentation

* Do not access filesystem if configuration is supplied

* Make the configuration log clearer

* Make the conf default value to `null`
2017-05-31 13:36:07 +05:30
Tim Neutkens b8f336c747 Add custom webpack dev middleware config (#1931) 2017-05-13 16:44:21 -07:00
Arunoda Susiripala dec85fe6c4 Add CDN support with assetPrefix (#1700)
* Introduce script tag based page loading system.

* Call ensurePage only in the dev mode.

* Implement router using the page-loader.

* Fix a typo and remove unwanted code.

* Fix some issues related to rendering.

* Fix production tests.

* Fix ondemand test cases.

* Fix unit tests.

* Get rid of eval completely.

* Remove all the inline code.

* Remove the json-pages plugin.

* Rename NEXT_PAGE_LOADER into __NEXT_PAGE_LOADER__

* Rename NEXT_LOADED_PAGES into __NEXT_LOADED_PAGES__

* Remove some unwanted code.

* Load everything async.

* Remove lib/eval-script.js
We no longer need it.

* Move webpack idle wait code to the page-loader.
Because that's the place to do it.

* Remove pageNotFound key from the error.

* Remove unused error field 'buildError'

* Add much better logic to normalize routes.

* Get rid of mitt.

* Introduce a better way to register pages.

* Came back to the mitt() based page-loader.

* Add link rel=preload support.

* Add assetPrefix support to add support for CDNs.

* Add assetPrefix support for preload links.

* Update readme.md
2017-04-17 21:18:43 -07:00
Arunoda Susiripala 0007cd2a97 [custom server] Handle internal routes automatically (#1658)
* Implement the initial version.

* Improve the render logic a bit.

* Move all the webpack paths under /_next/

* Keep the log:false flag.
2017-04-07 10:58:35 -07:00
Arunoda Susiripala fd430e53bf Revert "Ignore .next from hot reload watcher" (#1313) 2017-02-28 09:46:11 +01:00
Tim Neutkens 4620cd8cd6 Ignore .next from hot reload watcher (#1307)
* Move on-demand-entries-ping to _next namespace

* Ignore .next from watching
2017-02-27 13:35:17 -08:00
Arunoda Susiripala d3b1ead149 Implement "on demand entries" (#1111)
* Add a plan for dynamic entry middleware.

* Use dynamic pages middleware to load pages in dev.

* Add the first version of middleware but not tested.

* Integrated.

* Disable prefetching in development.
Otherwise it'll discard the use of dynamic-entries.

* Build custom document and error always.

* Refactor code base.

* Change branding as on-demand entries.

* Fix tests.

* Add a client side pinger for on-demand-entries.

* Dispose inactive entries.

* Add proper logs.

* Update grammer changes.

* Add integration tests for ondemand entries.

* Improve ondemand entry disposing logic.

* Try to improve testing.

*  Make sure entries are not getting disposed in basic integration tests.

* Resolve conflicts.

* Fix tests.

* Fix issue when running Router.onRouteChangeComplete

* Simplify state management.

* Make sure we don't dispose the last active page.

* Reload invalid pages detected with the client side ping.

* Improve the pinger code.

* Touch the first page to speed up the future rebuild times.

* Add Websockets based pinger.

* Revert "Add Websockets based pinger."

This reverts commit f706a49a3d886d0231259b7a1fded750ced2e48f.

* Do not send requests per every route change.

* Make sure we are completing the middleware request always.

* Make sure test pages are prebuilt.
2017-02-26 11:45:16 -08:00
Naoyuki Kanezawa 141ab99888 build on tmp dir (#1150) 2017-02-15 10:03:33 -03:00
Thomas Lindstrøm acc1983f80 Don't delete .next folder before a replacement is built (#1139) 2017-02-14 20:14:30 -03:00
Naoyuki Kanezawa 43149bdb08 fix not to overwrite the ignored option on Windows (#824) 2017-01-19 08:09:40 +01:00
Naoyuki Kanezawa 0c82d8a483 hot-reloader: return when rejected (#689) 2017-01-07 18:02:29 -08:00
Naoyuki Kanezawa 0a3313d1b9 add the watch ignored setting (#636) 2017-01-03 10:05:04 -08:00
Arunoda Susiripala 165924b71b Add Gzip support for JSON pages (#571)
* Server JSON pages directly from the filesystem.

* Make Json pages even if there's an error.

* Implement much better page serving.

* Use JsonPagesPlugin in the production mode as well.

* Add gzip support for JSON pages.

* Use glob-promise instead of recursive-readdir

* Handle renderStatic 404 properly.

* Simply the gzip code.

* Cache already read JSON pages.

* Change JSON pages extension to .json.

* Fix HMR related issue.

* Fix hot-reload for .json solely on server.

* Properly clear cache on hot-reloader.

* Convert .js pages into .json page right inside the plugin.

* Fix gzipping .json pages.

* Remove unwanted json pages cleanup.

* Get rid of deprecated fs.exists for fs.access
2016-12-31 21:46:23 +09:00
Naoyuki Kanezawa 798fd3c1e8 Fix custom document compilation (#534)
* compile _document using webpack

* don't emit the bundle file of _document.js

* exclude _document.js from minChunks of CommonsChunkPlugin

* handle creation/removal of pages/_document.js

* improve path handlings
2016-12-27 15:28:19 -08:00
Naoyuki Kanezawa 4faa281f23 suppress logging on test (#455) 2016-12-21 06:39:08 -08:00
nkzawa 59d514e071 stop watching files after running tests 2016-12-17 13:04:40 +09:00
Naoyuki Kanezawa 1708222381 Programmatic API (#310)
* add 'next' api

* add render APIs

* add 'as' prop to Link

* check Accept header to serve json response

* check if response was finished on getInitialProps call

* move server/app to server/index

* load webpack-hot-middleware-client by absolute path

* server: options for testing

* add tests

* example: improve

* server: make dir optional

* fix client routing

* add parameterized routing example

* link: fix display url

* Add custom-server-express example (#352)

* Add custom-server-express example

* Remove extraneous nexts in express routes defs

* Update next config in server.js

* Handle accept headers totally inside Next.js (#385)

* Handle accept headers totally inside Next.js
Now user doesn't need to handle it anymore.

* Move json pages serving to /_next/pages base path.

* Join paths correctly.

* remove next/render
2016-12-16 12:33:08 -08:00
Naoyuki Kanezawa 8ddafaea5c custom document support (#405) 2016-12-16 10:42:40 -08:00
nkzawa 4a71fb6b3c Merge branch 'master' into pr/264 2016-12-02 10:21:21 +09:00
Ian Mitchell 7a66870af9 Add Polling for Bash on Windows (#302)
* Add Polling for Bash on Windows

Fixes #166

* Add Windows Bash Dependency
2016-11-28 09:04:59 -05:00
Naoyuki Kanezawa c7ba914f52 Handle runtime errors (#268)
* display runtime errors by error-debug

* server: fix status

* render Error component on client error

* server: render runtime errors of error template

* server: handle errors of error template on render404

* server: add a comment

* server: refactor renderJSON

* recover from runtime errors

* _error: check if xhr exists

* _error: improve client error

* _error: improve error message
2016-11-24 23:03:16 +09:00
Naoyuki Kanezawa a14cc66720 Remove webpack-dev-server (#276)
* remove webpack-dev-server

* webpack: fix publicPath
2016-11-23 10:32:49 -08:00
Chris Cunniff 880b71047b fixes #175, no longer sets process.env.NODE_ENV='production' or runs uglify in next dev mode (#274) 2016-11-18 16:26:17 +09:00
Florian Didron becf2f2a62 Adds friendly error plugin 2016-11-16 11:46:58 +09:00
nkzawa a3548a6717 hot-reloader: remove fileSystem property 2016-11-01 01:15:50 +09:00
Naoyuki Kanezawa f335c21c7c hot-reload failed and succeeded chunks (#167) 2016-10-31 19:51:03 +09:00
nkzawa 7569ef6ca9 hot reload compilation errors 2016-10-25 00:20:50 +09:00
nkzawa 7ec46d512b hot reload added/removed pages 2016-10-24 16:22:15 +09:00
nkzawa 07b95ae080 dynamically add/remove pages 2016-10-24 01:42:13 +09:00
nkzawa 2e2db37ccb add error page for debug 2016-10-19 21:41:45 +09:00
nkzawa f2d456b986 less logs to display on compile error 2016-10-18 18:33:49 +09:00
nkzawa ae5098599a hot-reloader: refactoring 2016-10-17 16:05:46 +09:00
nkzawa 3032ade283 write assets to disk 2016-10-16 04:49:42 +09:00