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

97 commits

Author SHA1 Message Date
Naoyuki Kanezawa 9348762f4a add next/error (#1040) 2017-02-08 16:59:33 -03:00
Arunoda Susiripala 55f48563a0 Add babel-preset-latest support. (#1027)
* Add babel-preset-2016 support.
This adds the support for Exponentiation operator (**)

* Use babel-preset-latest.

* Remove babel-plugin-transform-async-to-generator in favor of babel-plugin-latest
It has es2017 preset and it comes with the above plugin.
2017-02-08 13:05:25 +01:00
Lukas Strassel 4a73ccbb00 add react and react dom as peer (#1024)
- tackles #997
- add ./idea to gitignore for webstorm users
- update all the examples
2017-02-08 10:11:38 +05:30
Naoyuki Kanezawa ddd93e9865 Improve babel settings (#976)
* fix babelrc settings

* use only transform-es2015-modules-commonjs for transpiling emitting files
2017-02-03 12:18:44 -08:00
Tim Neutkens 3143e0d0a1 Add styled-jsx to babel plugins (#970)
* Resolve all modules through module resolver

* Add styled-jsx back
2017-02-03 12:09:52 +05:30
Arunoda Susiripala 57e9a5e5f6 Find custom babel config location properly. (#969)
* Find custom babel config location properly.
Earlier we simply check for the .bablerc file in the dir.
But the actual logic is much complex.
Now we are using the babel's actual logic to find the
custom config location.

* Fix failing tests.
2017-02-03 14:33:35 +09:00
Tim Neutkens efe0c7b433 Resolve all modules through module resolver (#963) 2017-02-02 15:58:02 -08:00
Arunoda Susiripala 24edfbdea7 Resolve styled-jsx/style when transpiling ES2015 modules. (#953) 2017-02-02 06:56:21 +01:00
Tim Neutkens f9717347a4 Resolve preset es2015 from next directory (#949) 2017-02-02 07:35:21 +05:30
Arunoda Susiripala ec2c8c6784 Fix .json import issue (#944)
* Fix .json import error
This is a regression we've added by #926 (tree-shaking-support)

* Add a test case.
2017-02-01 15:17:15 +09:00
Arunoda Susiripala f3e541fe23 Add support for Webpack 2's tree-shaking (#926)
* Let webpack2 to handle ES2015 module system
Since Node.js can't do that, we need to transpile
ES2015 module system in the emit-file-loader.

* Use sourceMaps only in dev.

* Introduce a transform option to emit-file-loader
So, we can move our ES2015 transpile code with that option.

* Remove unwanted argument options.

* Update comments.

* Use dev flag instead of NODE_ENV
2017-01-31 15:31:27 +09:00
Arunoda Susiripala 60ec4def1e Add NODE_PATH support for resolveLoaders as well. (#778)
* Add NODE_PATH support for resolveLoaders as well.

* Remove unwanted code.
2017-01-16 14:40:14 +09:00
nkzawa 8a06c7b092 example: fix style 2017-01-15 00:30:39 +09:00
Naoyuki Kanezawa dbecc2a701 Use dynamic entry feature of webpack (#750)
* update webpack version and use dynamic entry feature of it

* fix typo
2017-01-12 07:39:04 -08:00
nkzawa 4c32dd96b7 remove unused module alias 2017-01-12 12:39:07 +09:00
Naoyuki Kanezawa 0ef28ab128 Don't discard component state on error (#741)
* render debug page as overlay

* handle errors occurrred on rendering cycle for HMR

* retrieve props if required on HMR
2017-01-11 17:58:20 -08:00
Arunoda Susiripala 8811a334f4 Remove default next pages compilation from the main babel-loader. (#731)
* Remove default next pages compilation from the main babel-loader.
This will fix the issue when the user ignore node_modules
via our .babelrc option.

* Change babel-loaders 'query' to 'options'.
That's what's supported/recommended in webpack 2
2017-01-11 17:57:33 -08:00
Arunoda Susiripala b7e57f9347 Implement "Immutable build artifacts" feature (#745)
* Write BUILD_ID when building.
It's a random id (uuid.v4())

* Add buildId to the core JS files.

* Add immutable cache-control header.
Only if the buildId is matched.

* Set '-' as the dev buildId always.

* Add buildId handling for JSON pages.
2017-01-11 12:16:18 -08:00
Arunoda Susiripala 88e4adfc2a Add case sensitive checks for imports and JSON page resolver (#697)
* Add case-sensitive-paths-webpack-plugin plugin.

* Add case-sensitive check for server/resolve.
2017-01-08 18:12:29 -08:00
Naoyuki Kanezawa 929041133c resolve react-dom/server (#688) 2017-01-07 21:56:51 -08:00
Naoyuki Kanezawa b8373b847d fix HMR for dynamic entries (#652) 2017-01-05 09:29:09 -08:00
Naoyuki Kanezawa 47a7a480d4 set output.strictModuleExceptionHandling option (#655) 2017-01-05 09:28:54 -08:00
Arunoda Susiripala 4b9f3fc431 Fix JSON pages not building on Windows (#611)
* Check for .json file extension before JSON parse. Was throwing when reading js files.

* Fix cross platform regex

* Revert back to the original content in read-page.js
2017-01-01 20:06:49 -08:00
Naoyuki Kanezawa 1e308c7118 fix webpack resolve paths (#592) 2016-12-31 21:57:13 -08:00
Naoyuki Kanezawa 8d543bd148 remove the monkeypatch of watchpack (#580) 2016-12-31 11:40:18 -08:00
Arunoda Susiripala 3dae510d51 Add app's node_modules dir to resolveLoaders. (#583)
Otherwise, webpack will throw an error saying
it couldn't find entries.
That's because it couldn't find babel-loader and
other loaders installed into app's node_modules dir.
2016-12-31 22:17:52 +09: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
Arunoda Susiripala 29c226771c Add AOT gzip content-encoding support for main build files. (#565)
* Add AOT gzip content-encoding support.
Currently we only do this for
main.js and commons.js only.

* Remove unwanted await.

* Use Promise.all to gzip assets in parallel.
2016-12-29 14:38:19 -08:00
Naoyuki Kanezawa ff117b7ed6 Webpack 2 (#449)
* upgrade webpack

* fix WatchRemoveEventPlugin for webpack2

* use webpack2 for building for files

* bump webpack

* bump webpack

* monkeypatch watchpack
2016-12-28 10:16:52 -08: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
Arunoda Susiripala ac2a71876d Add support for using .babelrc in the app root. (#493)
* Add support for using .babelrc in the app root.

* Update the README about the .babelrc usage.

* Fix a typo.

* Remove additional example usage.
2016-12-26 10:13:45 -08:00
Naoyuki Kanezawa ad0f0a4d79 watch-page-plugin: prevent null access (#523) 2016-12-26 10:13:28 -08:00
Naoyuki Kanezawa d1f8b1aef1 fix recovering runtime error (#515) 2016-12-25 12:03:07 -08:00
Arunoda Susiripala f7b9cb009f Add cacheDirectory support for babel-loader. (#487)
This will improve the initial babel compilation
specially for larger projects.
2016-12-23 09:49:29 +09:00
Arunoda Susiripala aa7fccbbc4 Fix incorrect babal alias for next/router. (#480) 2016-12-22 22:00:11 +09:00
Arunoda Susiripala 1719738ed1 Allow to customize our babel configuration (#466)
* Add a way to customize babel configurations.

* Add babel configuration docs to README.
2016-12-21 17:36:00 -08:00
Naoyuki Kanezawa 4faa281f23 suppress logging on test (#455) 2016-12-21 06:39:08 -08:00
Arunoda Susiripala 2798df5745 Create a babel-preset for plugins and presets we use. (#445)
* Create a babel-preset for plugins and presets we use.
Anyone could get it via 'next/babel'

* Remove  'use strict' from the source.

* Add next/router to alias resolver in our babel preset.
2016-12-20 18:01:56 -08:00
Naoyuki Kanezawa a87ef1a7af Incorporate styled-jsx (#420)
* integrate styled-jsx

* define styles of pages with styled-jsx

* bump styled-jsx

* bump styled-jsx

* error-debug: fix style

* bump styled-jsx

* fix examples to use styled-jsx

* bump styled-jsx
2016-12-19 10:42:19 -08:00
Ives van Hoorne 5ab7463b93 Exploration of different config + expose webpack config (#222)
* Use next.config.js instead of package.json

* Remove irrelevant comment

* Integrate with custom webpack config

* Include hotReload option

* Remove async/await for getConfig

* Read package.json, show warning when webpack in config is defined

* Prepend warning message with WARNING

* Update log statements

* Documentation

* Restart server on change of config

* Fix process handling and cases where there is no config

* Also restart server when config file gets deleted

* Changed second parameter of webpack to config

* Support for returning Promise

* Update documentation, fix bug with webpack config

* Remove package.json, cdn and hotReload from config
2016-12-17 10:38:11 -08:00
Arunoda Susiripala b62a0e8f55 Bundle all the modules inside the app (#414)
* Remove the use of CDN and bundle everything inside the app.
We still pre-build the prefetcher because it needs
different webpack config which only targets browsers
supports Service Workers.

* Remove cdn config item.
We no longer using it.

* Stop adding script tags when staticMarkup=true

* Remove babel-plugin-transform-remove-strict-mode NPM module.
2016-12-17 17:49:10 +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
Arunoda Susiripala aa6870a4e6 Fix #204 (#401)
React addons require React in a special way.
That causes Webpack to push React into the app's bundle.
This fix adds new externals entries to prevent that.
2016-12-15 17:45:58 -08:00
Dmitry Poddubniy 45e36fdff7 fixed bug #362, also set chunks names (#363)
* fixed bug #362, also set chunks names

* set simple solution for minChunks

* revert in favor of #310
2016-12-16 03:59:59 +05:30
Arunoda Susiripala 36abdc77c5 Prefetch pages with Service Workers (#375)
* Register the service worker.

* Update prefetcher code to do prefetching.

* Implement the core prefetching API.
support "import <Link>, { prefetch } from 'next/prefetch'"

* Implement a better communication system with the service worker.

* Add a separate example for prefetching

* Fix some typos.

* Initiate service worker support even prefetching is not used.
This is pretty important since initiating will reset the cache.
If we don't do this, it's possible to have old cached resources
after the user decided to remove all of the prefetching logic.
In this case, even the page didn't prefetch it'll use the
previously cached pages. That because of there might be a already running
service worker.

* Use url module to get pathname.

* Move prefetcher code to the client from pages
Now we also do a webpack build for the prefetcher code.

* Add prefetching docs to the README.md

* Fix some typo.

* Register service worker only if asked to prefetch
We also clean the cache always, even we initialize
the service worker or not.
2016-12-15 11:13:40 -08:00
nkzawa b4ccb126d9 ignore .babelrc on babel-loader 2016-12-11 18:09:54 +09:00
Arunoda Susiripala 7086287eaf Set the default minChunks values to the length of pages. (#350)
Earlier it was for all length of entry points.
But we add two more entry points for errors.
Because of that, moving common modules to commons.js won't work.
2016-12-06 10:25:01 +01:00
Naoyuki Kanezawa edfdc482e3 fix to not call hot.accept on sub-components (#294) (#351) 2016-12-06 10:24:42 +01:00
Naoyuki Kanezawa 9990a5fc78 use react-hot-loader/webpack (#338) 2016-12-05 18:09:38 +01:00