Commit graph

100 commits

Author SHA1 Message Date
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
Tim Neutkens
52ccc14059 Merge branch 'canary'
# Conflicts:
#	examples/with-markdown/readme.md
#	lib/page-loader.js
#	package.json
#	server/build/plugins/pages-plugin.js
2017-12-08 15:11:37 -08:00
Arunoda Susiripala
820e3ff716
Always load pages with ".js" extension (#3393)
* Always fetch pages with '.js' extention from client side.

* Load error page always from _error.js rather _error/index.js

* Load pages from page.js instead of page/index.js from the client for static exports.

* Update index.js

* Simplify the path re-write logic in the webpack pages-plugin.
2017-12-05 04:49:53 +05:30
Isaac Ellmen
dc07cd1b19 Set Cache-Control max-age to a year (#3247) 2017-11-09 21:27:01 +01:00
Kevin Decker
53a2c5a7fc Combine source maps (#3178)
* Propagate source maps through combine assets step

* Use constant development build id

* Move combine assets step before uglify step

This ensures that uglify will catch these changes.

* Move dynamic chunks step before uglify step

This ensures that uglify will catch these changes.

* Use chunk templates for page and dynamic chunks

This is a little more in line with how webpack generates its bootstrap and should have better compatibility with other plugins and source map generation.

* Register combined source map with chunks

This ensures that a sourcemap is fully generated.

* Do not minimize combined map inputs
2017-10-30 15:57:35 +01:00
Tim Neutkens
1cc3dbe35b Revert "Sourcemap and Breakpoint Fixes (#3121)"
This reverts commit 964f229f98.
2017-10-20 08:02:04 +02:00
Kevin Decker
964f229f98 Sourcemap and Breakpoint Fixes (#3121)
* Propagate source maps through combine assets step

* Use constant development build id
2017-10-19 22:11:37 +02:00
Arunoda Susiripala
0c8dca6f97 Warn and exit if React 15 used inside the project. (#3061)
This usually helps when upgrading Next.js.
2017-10-09 13:25:12 -07: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
Kevin Decker
d600957aeb Add node trace source map handling in dev mode (#2816)
* Add node trace source map handling in dev mode

Fixes #2285

* Fix typo in comment
2017-08-30 16:19:40 +05:30
Arunoda Susiripala
10241fe610 Fix the route redirect error when we've multiple path params. (#2652)
For an example, with a URL like: /static/data/hello.txt
2017-07-26 22:31:49 +05:30
Arunoda Susiripala
564dbdd237 Add a test case to prevent issue #2617 to happen again. 2017-07-24 11:43:45 +05:30
Arunoda Susiripala
7965cb299d Merge master into v3-beta. 2017-07-24 10:10:29 +05:30
Arunoda Susiripala
c03c86ee5e Make sure /static/ and /_next/ are valid internal urls. (#2631) 2017-07-24 10:04:06 +05:30
Arunoda Susiripala
c97aca50e5 Show webpack errors in all pages. (#2588)
* Show webpack errors in all pages.
When there's a webpack error that means HMR failed too.
So, showing other pages won't makes sense since user
can't edit them and get changes via HMR.
That's why now we show the error on all pages.

* Remove exact propType checks from the error component.
When there's an error, something this check shows in the console.
That means it could accept more props.
Also this is not a public API. So, we don't want to do propType checks.
2017-07-18 12:30:23 +05:30
Arunoda Susiripala
f25055c9f7 Load the hot-reloader when only needed. (#2566)
This reduce the server boot-up time a lot.
With a 2015 MacBook Pro, it went down from 1000ms to 200ms
2017-07-15 18:29:10 +08:00
Arunoda Susiripala
1c7b2603d4 Block special pages from the public. (#2479)
Otherwise, users could invoke 500 errors.
2017-07-06 17:59:25 +05:30
Arunoda Susiripala
9395718ee1 Consider using distDir config for dynamic chunks. (#2436) 2017-07-02 11:23:15 +05:30
Tim Neutkens
c8e8cb5e52 Check if parsedUrl is an object (#2066) 2017-07-02 11:22:39 +05:30
Xuezheng Ma
4eb86dc5f8 Added proper error for running next start on dev build (#2337)
* Added proper error for running `next start` on dev build

* Check if build exist before usage

* Move BUILD_ID check from bin/next-start to server/index.js

* Check env before checking build
2017-06-26 22:18:56 +02:00
Arunoda Susiripala
fe77397f26 Make sure internal url always has 200 status code. (#2299)
Even the user set it to something else via custom server api.
2017-06-19 12:57:35 +05:30
Arunoda Susiripala
0c4362e440 Load chunks in SSR mode only if they exists in the filesystem (#2196)
* Always check with the fs when gettings chunks.

* Add a new set of test cases for dynamic imports in dev.

* Add dynamic import test cases for production.

* Add availableChunks support for static exports.
2017-06-08 19:41:22 +02:00
Arunoda Susiripala
8cb3e89455 Merge master into v3-beta. 2017-06-07 04:24:36 +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
Guillermo Rauch
850a931e88 Merge branch 'master' into v3-beta 2017-06-01 18:30:57 -07:00
Arunoda Susiripala
43c447edd0 Implement the fix. 2017-06-01 05:46:32 +05:30
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
George Pantazis
2953a01c43 Make file-system based routes optional for custom servers (#914) 2017-05-27 21:10:15 +05:30
Arunoda Susiripala
9121a9d22e Never cache assets and HTML in the dev mode. (#2045)
* Never cache assets and HTML in the dev mode.

* Move etags test to the production.

Now it won't work in dev because of no-cache settings.
2017-05-25 18:28:08 +02:00
Arunoda Susiripala
3c95f21d8c Do not try to server unnessesary files in either dev or prod. (#2048) 2017-05-23 10:30:14 -07:00
Arunoda Susiripala
4d0147385c Merge v3-beta in dynamic-imports 2017-05-15 09:41:42 +05:30
Arunoda Susiripala
450277f294 Make sure next export doesn't break other modes. 2017-05-09 00:42:48 -07:00
Dieter Luypaert
cb635dd9a5 use configured distDir where required (#1816) 2017-05-01 17:42:01 -07:00
Arunoda Susiripala
358cfb3a29 Make dynamic import support to work with HMR. 2017-04-27 12:41:02 -07:00
Arunoda Susiripala
90ea471aa7 Merge master into dynamic-import. 2017-04-18 21:42:21 +05:30
Arunoda Susiripala
f82e52935d Implement ETag support for server rendered pages. (#1693) 2017-04-18 21:15:42 +05:30
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
f51300f14b Add core import() support. 2017-04-17 21:03:40 +05:30
Arunoda Susiripala
b5bd0daf62 Remove unused error field 'buildError' 2017-04-11 14:55:53 +05:30
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
866319c76d Merge with master. 2017-04-06 15:44:05 +05:30
alex newman
9347c8bdd0 Specify a different build directory for #1513 (#1599)
* Update references to `.next`

* Remove console logs and extraneous semi colons

* Remove lint errors

* Update references to .next and update docs

* Update options from nested to flat with `distDir`

* Add integration tests, and update `.gitignore`

* Rename integration folder to dist-dir to match standards
2017-04-06 15:39:26 +05:30
Arunoda Susiripala
5aa02d0727 Remove the json-pages plugin. 2017-04-06 10:33:11 +05:30
Arunoda Susiripala
76bfc38a09 Remove all the inline code. 2017-04-05 17:13:34 +05:30
Arunoda Susiripala
e3d68ff401 Fix a typo and remove unwanted code. 2017-04-05 02:05:25 +05:30
Arunoda Susiripala
c95d2b28d0 Implement router using the page-loader. 2017-04-05 01:25:56 +05:30
Arunoda Susiripala
8938843025 Call ensurePage only in the dev mode. 2017-04-03 23:44:42 +05:30
Arunoda Susiripala
a0945c7800 Introduce script tag based page loading system. 2017-04-03 23:40:24 +05:30
Arunoda Susiripala
bb72e19190 Move all NPM modules into a single chunk in dev mode. (#1512)
This will isolate all the NPM modules into a single chunk.
That chunk won't touch by webpack unless, there's a new NPM module.
That gives us much better re-build performance.
2017-03-26 13:48:59 -07:00
Guillermo Rauch
50274959cb Revert "Move all NPM modules into a single chunk in dev mode. (#1505)"
This reverts commit a879f47f9a.
2017-03-26 11:24:58 -07:00