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

42 commits

Author SHA1 Message Date
Kyle Holmberg b7fe234005 404 routing for static export without exportPathMap (#5036)
Resolves #5035 

Thanks a billion to @timneutkens for holding my hand
2018-08-27 12:28:54 +02:00
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
Rafał Ruciński 7333dd622c Process available chunk names properly in dev mode (#4604)
Fixes #4603.

Tests explain it the best:

```js
    describe('development mode (no chunkhash)', () => {
      it('should strip the extension from the filename', () => {
        const filename = 'foo_bar_0123456789abcdef.js'
        expect(getChunkNameFromFilename(filename, true)).toBe('foo_bar_0123456789abcdef')
      })

      it('should only strip the extension even if there\'s a hyphen in the name', () => {
        const filename = 'foo-bar-0123456789abcdef.js'
        expect(getChunkNameFromFilename(filename, true)).toBe('foo-bar-0123456789abcdef')
      })
    })

    describe('production mode (with chunkhash)', () => {
      it('should strip the hash from the filename', () => {
        const filename = 'foo_bar_0123456789abcdef-0123456789abcdef.js'
        expect(getChunkNameFromFilename(filename, false)).toBe('foo_bar_0123456789abcdef')
      })

      it('should only strip the part after the last hyphen in the filename', () => {
        const filename = 'foo-bar-0123456789abcdef-0123456789abcdef.js'
        expect(getChunkNameFromFilename(filename, false)).toBe('foo-bar-0123456789abcdef')
      })
    })
```
2018-06-14 11:04:03 +02:00
Tim Neutkens a7bb9175eb
Clean up references to this.dir and this.dist everywhere (#4535)
This was spread around the server. Now it's set in one place and passed around.
2018-06-04 15:45:39 +02:00
Tim Neutkens fbaeba49b6
Add CONFIG_FILE constant, add types for server/config.js (#4529)
This was pulled from #4518, it can already be merged so it's easier to get it in.
2018-06-04 11:38:46 +02:00
Tim Neutkens 098f3fd7e9
Rename dist to server to be more consistent (#4506)
Previously we called this directory holding the pages/chunks for server rendering `.next/dist` instead of `.next/server` which is confusing both when looking at it and in the codebase, since there's also `distDir` as a configuration option.

Also made this a constant in `next/constants` so functionality using this can be easily found.
2018-05-31 20:56:04 +02:00
Cédric Marcone d3c710b325 Fixes 'next export' when exportPathMap function depends on runtime config (#4339) 2018-05-11 14:52:39 +02:00
Tim Neutkens 0f2c8f5eb1
Exclude _app.js since it’s not a normal page (#4201) 2018-04-23 13:27:53 -07: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 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
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
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
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
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
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
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
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 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
Maciej Kasprzyk a3aa870b74 feat: error when exported path has no backslash (#3456) 2017-12-14 13:22:04 -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
Jesse Ditson a79357f2a4 Allow use of filenames in exportPathMap (#2973)
* allow use of filenames in exportPathMap

* add link test and handling for file paths when flattening links for export

* add note about exporting file paths to readme.md
2017-10-05 20:33:10 +02:00
Craig Mulligan a50e440cf1 Pass conf to export function (#2962)
* Pass conf to export function

* conf -> configuration
2017-09-27 20:48:46 +02:00
Mic Wehrle 27f517d27d Fix error messages in server/export.js (#2933) 2017-09-10 13:13:48 +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
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
David Corwin ca9146c421 support custom build directory in next export (#2135)
* use custom build directory instead of .next if specified, helpful log messages.

* Remove some unwanted newlines.
2017-06-08 07:09:45 +05:30
Arunoda Susiripala 92b0a690be Add a default value of '{}' to query in the export mode. (#2003) 2017-05-18 10:54:57 +05:30
Tim Scanlin a8fdbb261e delete files only from outDir (#2001) 2017-05-18 09:58:22 +05:30
Guillermo Rauch b0a9161462 fix typo 2017-05-16 09:41:35 -07:00
Arunoda Susiripala aeaccf441b Add dynamic-import support for next-export. 2017-05-15 10:03:35 +05:30
Arunoda Susiripala c40ded0c12 Copy the static directory for static file serving. 2017-05-14 05:41:13 +05:30
Arunoda Susiripala 430789b99f By default print some messages to the console.
Also added a silent option if someone don't want
those messages.
2017-05-11 09:23:08 -07:00
Arunoda Susiripala 4be25270c6 Do not include /_document.js when running 'next export' 2017-05-11 08:59:29 -07:00
Arunoda Susiripala 6f674b8c0a Get rid of realPathname for consistant page file structure. 2017-05-10 20:01:42 -07:00
Arunoda Susiripala 42f1d2efda Add a way to customize the output directory. 2017-05-08 19:10:55 -07:00
Arunoda Susiripala 71296cceb3 Add the verbose mode. 2017-05-08 18:53:08 -07:00
Arunoda Susiripala 311e4ca0ee Make sure the router is aware of the nextExport
Based on the we can change the routing to do SSR always.
Also make sure pageLoader don't download the page via
client side twice.
2017-05-08 18:20:50 -07:00
Arunoda Susiripala d4aa2b0408 Allow create dynamic content. 2017-05-08 10:22:32 -07:00
Arunoda Susiripala dcc3228429 Allow next export to build html pages. 2017-05-07 23:10:26 -07:00
Arunoda Susiripala f602f6dc1e Copy all the static assests to .out 2017-05-07 15:47:40 -07:00