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

163 commits

Author SHA1 Message Date
Logan Smyth 2495316235 Use custom Babel loader to avoid using separate Babel copies for loader and loader options (#4417)
This resolves the

> .value is not a valid Plugin property

error showing up for people in https://github.com/zeit/next.js/issues/4227

cc @timneutkens
2018-05-23 20:26:57 +02:00
Tim Neutkens f620b8f455
Don’t use chunkhash in development (#4436)
* Don’t use chunkhash in development

* Add test for dynamic imports styling

* Remove pre-load of dynamic page

* Make sure the browser gets closed only once
2018-05-23 14:37:02 +02:00
Yuri bced1b1c25 Fixing ios10 issue with webpack-uglify plugin (#4385)
* fix: fixing issue with ios10 and webpack uglify es httebpack-plugin/issues/92

* chore: formatting

* chore: formatting
2018-05-16 14:07:10 +02:00
Tim Neutkens 737f6cfce0
Set babelrc true (#4215) 2018-04-26 11:26:42 -07:00
Tim Neutkens 68626c5147 Improved stacktraces (minor) (#4156)
* Handle production errors correctly

* Improved source map support

* Make react-hot-loader hold state again

* Remove console.log

* Load modules on demand

* Catch errors in rewriteErrorTrace

* Update comment

* Update comment

* Remove source-map-support

* Load modules in next-dev

* Make sure error logged has sourcemaps too

* Add tests for production runtime errors

* Add tests for development runtime errors. Fix issue with client side errors in development

* Move functionality back to renderError now that error handling is consistent

* Rename to applySourcemaps
2018-04-18 21:48:06 +05:30
Tim Neutkens 05b7286454
Use object directly since webpack doesn’t parse the string (#4140) 2018-04-14 10:18:41 +02:00
Tim Neutkens eca8e8f64b
Expose app.js (#4129)
* Expose pages/_app.js

* Add tests for _app and _document

* Uncomment deprecation warnings

* Add documentation for _app, improve documentation of _document

* Update docs / test for _document

* Add _document to client compiler in development

* Add missing app.js to comment

* Only warn once

* Add url-deprecated error page

* Combine tests

* Yse same message for all methods of ‘props.url’

* Update docs around _app

* Update documentation

* Quotes

* Update table of contents
2018-04-12 10:33:22 +02:00
Tim Neutkens 15dde33794
Add build manifest (#4119)
* Add build manifest

* Split out css since they don’t have exact name

* Remove pages map

* Fix locations test

* Re-run tests

* Get consistent open ports

* Fix static tests

* Add comment about Cache-Control header
2018-04-12 09:47:42 +02:00
Tim Neutkens 2d8c19a450
Upgrade Babel 6 to Babel 7 (major) (#4050)
Upgrade Babel 6 to Babel 7 (major)
2018-04-03 09:34:07 +02:00
Tim Neutkens c3318d8ef6
Make sure hot-self-accept-loader cleans up the route correctly (#4092) 2018-03-31 23:19:06 +02:00
Tim Neutkens a785f303f4
Match externals ending in .js not everything with .js (#4091)
Makes sure highlight.js/styles/dark.css doesn’t get caught by externals.
2018-03-31 16:08:16 +02:00
Tim Neutkens 0b9b902a89 Get pages before entry function (#4089) 2018-03-31 17:30:56 +05:30
Tim Neutkens e90f89633c
Add flow, pages-manifest.json, defaultPathMap for export (minor) (#4066)
* Initial implementation of next export without exportPathMap

* Shorter message

* Set up flow

* Create pages manifest

* Use pagesManifest for next export

* Fix tests

* Document defaultPathMap

* Replacing the path is no longer needed

* Use posix normalize for consistent behaviour

* Remove second instance of examples

* Add comment about what pages-manifest does

* Make windows path a route
2018-03-30 15:08:09 +02:00
Tim Neutkens 14a16924c5 Make sourcemap paths relative in production 2018-03-23 17:10:23 +01:00
Tim Neutkens ac7a23d595
Make sure react and react-dom are bundled to main.js in development (#4039)
Signed-off-by: Tim Neutkens <timneutkens@me.com>
2018-03-21 12:16:44 +01:00
Tim Neutkens 521b722aa2 Enable conditionals and evaluate uglify 2018-03-08 09:52:40 +01:00
Tomas Roos 76582b8e43 Enable source maps in webpack chunking + bundling process (#3793)
* Removed combine-assets-plugin, since its very broken

* Bundle everything into app.js on production build

* Clean up

* Removed app.js from server routes

* Renamed app.js -> main.js and removed commons from loading

* Remove commons and react CommonChunks

* Removed the commons route

* Killing the entire build-stats hack for app.js

* Removed unused md5-file package
2018-03-06 10:45:29 +01:00
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 7e756ee5d9
Expose totalPages to the webpack decorator (#3824) 2018-02-17 12:37:33 +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
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
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 863d4d3b4f Make sure externals logic works on Windows. (#3677) 2018-02-05 09:10:55 +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
Tim Neutkens b38c05bc95
Add NODE_PATH support (#3656) 2018-02-01 16:21:18 +01:00
Tim Neutkens 09500c25ff Don’t exclude webpack (#3646) 2018-02-01 15:00:52 +05:30
Tim Neutkens 8a4a9a10c2 Match .js instead of not css 2018-01-31 08:50:27 +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 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
Tim Neutkens 57a0fc432c
Clean up webpack config, increase build speed (#3487)
* 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
2018-01-03 13:43:48 +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
Tim Neutkens e2bcb039cf
Add .jsx extension support (#3376)
* Add .jsx extension

* examples: add create-next-app (#3377)

* examples: add create-next-app

* fix with-typescript readme

* Upgrading with-flow example to the latest flow-bin ver. 0.59.0 (#3337)

For upgrading I used flow-upgrade module by https://yarnpkg.com/en/package/flow-upgrade

* doc'd fs-routing option & added note on `passHref` (#3384)

2 changes:

`passHref` - just added a cautionary note on the importance of `passHref`. We had a few days of no-href links on our site b/c we used a custom component instead of a raw `<a>` tag,  and Google bot wasn't crawling our links (confirmed in Google cache). Hurt our SEO a bit, so I thought it was worth noting.


`useFileSystemPublicRoutes` - this is mentioned in https://github.com/zeit/next.js/pull/914 , but it doesn't appear any doc was actually added. We use `next-routes`, and we were serving all the files in `/pages/` in addition to their route patterns (ie duplicate content), which can be a pain w/ SEO and duplicate content.

* fix typo in readme.md (#3385)

* Upgrade styled-jsx to v2.2.1 (#3358)

* Pulled encoding to top of head (#3214)

* Remove next.d.ts to use @types/next (#3297)

* Add with-mobx-state-tree example (#3179)

* Adapt with-mobx example for with-mobx-state-tree

* Remove unnecessary lastUpdate parameter to show off snapshot

* update readme

* make other.js more closely mimic index.js

* Upgrade styled-jsx to v2.2.1

Includes some bug fixes.

* Fix linting

* Make sure import that doesn’t end in .jsx works

* Move tests

* Show error when .js and .jsx both exist

* Remove .jsx when importing from ‘path.jsx’

* Fixes

* Get .jsx resolver back

* Revert "Get .jsx resolver back"

This reverts commit 6f76712caa400e6f41a6a32ff80189a95b194cce.

* Revert "Revert "Get .jsx resolver back""

This reverts commit 69e592e86e53f28d0e1f78009196b76f2f831866.

* Add remove .jsx to preset

* Remove jsx resolver

* Revert "Remove jsx resolver"

This reverts commit 5e3ef1aca134de47657d91485809cd801e13329f.

* Revert "Revert "Remove jsx resolver""

This reverts commit 8248e5066cff1c7e33dac2e5a88ffe6856e3fc4e.

* Revert "Revert "Revert "Remove jsx resolver"""

This reverts commit 2a6d418a227ea4e59874b0374628ef497e527c52.

* Make 1 component not use .jsx
2017-12-05 15:46:06 -08:00
Adam Stankiewicz eefab8fb3e Disable comparisons to fix mapbox-gl bundling (#3346) 2017-11-28 14:19:14 +01:00
Saro Vindigni 8eb8034236 remove relative path to babel-runtime (#3119) 2017-11-23 14:02:09 +01:00
Jess Telford 80a1603189 Use uglify-es for minification (#3150) 2017-11-13 12:19:51 +01:00
Mattias Hällkvist 3eac0bc35d Make pages glob pattern overridable (#3195) 2017-11-05 22:27:31 +01:00
Sam Gluck 828dac7d61 Use fs.realpath to get actual project directory (#3243)
* resolve base dir symlink

* fix method name
2017-11-05 20:05:15 +01:00
Tim Neutkens 18f8ab392a Merge branch 'master' into canary
# Conflicts:
#	examples/with-apollo/lib/initApollo.js
#	examples/with-apollo/package.json
#	examples/with-react-with-styles/package.json
#	examples/with-static-export/package.json
#	package.json
2017-11-05 11:01:59 +01:00
Kevin Decker 6e44cdef5f Expose mechanism to monitor render events (#2655)
* Allow custom clientBootstrap entrypoint

This allows for customization of the client global bootstrap.

* Expose render event emitter to client

* Include client entry point in npm package
2017-10-30 16:01:40 +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
Marc MacLeod ddd30787ef expose buildId to custom webpack configs (#3001)
* expose buildId to custom webpack configs

* update readme to include buildId in option object
2017-09-27 08:03:29 +02:00
Kevin Decker 5c67fd6811 Do not mutate browser source map object (#2900)
Fixes regression caused by #2478
2017-09-04 20:27:19 +02: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 6477492f62 Move NPM modules out of the commons chunk in dev mode. (#2716)
This is only a dev feature and it removes an error in HMR.
Otherwise it'll throw an error with undefined error in the webpack core.
2017-08-07 12:36:24 +05:30
崔宁 67697afa44 Remove the extra plugin (#2670) 2017-07-28 10:45:04 +05:30
Tim Neutkens 2c7d0ec47a Uppercase location for consistency (#2622) 2017-07-23 19:50:48 +02:00
Arunoda Susiripala d831e6d39c Webpack's ModuleConcatenationPlugin plugin doesn't work well with HMR. (#2584)
So, now we only use it for production.
2017-07-17 22:16:39 +05:30