Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #2

Merged
merged 6 commits into from
Sep 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/dev-error-overlay/hot-dev-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ let customHmrEventHandler
export default function connect (options) {
// Open stack traces in an editor.
ErrorOverlay.setEditorHandler(function editorHandler ({ fileName, lineNumber, colNumber }) {
// Resolve invalid paths coming from react-error-overlay
const resolvedFilename = fileName.replace(/^webpack:\/\//, '')
fetch(
'/_next/development/open-stack-frame-in-editor' +
`?fileName=${window.encodeURIComponent(fileName)}` +
`?fileName=${window.encodeURIComponent(resolvedFilename)}` +
`&lineNumber=${lineNumber || 1}` +
`&colNumber=${colNumber || 1}`
)
Expand Down
4 changes: 1 addition & 3 deletions examples/with-custom-reverse-proxy/.babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"presets": [
"next/babel",
"latest",
"stage-0"
"next/babel"
]
}
3 changes: 0 additions & 3 deletions examples/with-custom-reverse-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"react-dom": "16.2.0"
},
"devDependencies": {
"babel-preset-latest": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"cross-env": "^5.0.1",
"http-proxy-middleware": "^0.17.4"
},
Expand Down
50 changes: 0 additions & 50 deletions examples/with-custom-reverse-proxy/server.es6.js

This file was deleted.

52 changes: 50 additions & 2 deletions examples/with-custom-reverse-proxy/server.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,50 @@
require('babel-register')
module.exports = require('./server.es6.js')
/* eslint-disable no-console */
const express = require('express')
const next = require('next')

const devProxy = {
'/api': {
target: 'https://swapi.co/api/',
pathRewrite: {'^/api': '/'},
changeOrigin: true
}
}

const port = parseInt(process.env.PORT, 10) || 3000
const env = process.env.NODE_ENV
const dev = env !== 'production'
const app = next({
dir: '.', // base directory where everything is, could move to src later
dev
})

const handle = app.getRequestHandler()

let server
app
.prepare()
.then(() => {
server = express()

// Set up the proxy.
if (dev && devProxy) {
const proxyMiddleware = require('http-proxy-middleware')
Object.keys(devProxy).forEach(function (context) {
server.use(proxyMiddleware(context, devProxy[context]))
})
}

// Default catch-all handler to allow Next.js to handle all other routes
server.all('*', (req, res) => handle(req, res))

server.listen(port, err => {
if (err) {
throw err
}
console.log(`> Ready on port ${port} [${env}]`)
})
})
.catch(err => {
console.log('An error occurred, unable to start the server')
console.log(err)
})
2 changes: 1 addition & 1 deletion examples/with-styled-components/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"plugins": [
[
"styled-components",
"babel-plugin-styled-components",
{
"ssr": true,
"displayName": true,
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "7.0.0-canary.7",
"version": "7.0.0-canary.8",
"description": "Minimalistic framework for server-rendered React applications",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -76,9 +76,9 @@
"ansi-html": "0.0.7",
"autodll-webpack-plugin": "0.4.2",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.0-beta.3",
"babel-loader": "8.0.0",
"babel-plugin-react-require": "3.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.13",
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
"case-sensitive-paths-webpack-plugin": "2.1.2",
"cross-spawn": "5.1.0",
"del": "3.0.0",
Expand All @@ -98,22 +98,22 @@
"mkdirp-then": "1.2.0",
"nanoid": "1.2.1",
"path-to-regexp": "2.1.0",
"prop-types": "15.6.0",
"prop-types-exact": "1.1.1",
"prop-types": "15.6.2",
"prop-types-exact": "1.2.0",
"react-error-overlay": "4.0.0",
"recursive-copy": "2.0.6",
"resolve": "1.5.0",
"send": "0.16.1",
"source-map": "0.5.7",
"strip-ansi": "3.0.1",
"styled-jsx": "3.0.2",
"styled-jsx": "3.0.3-canary.0",
"unfetch": "3.0.0",
"url": "0.11.0",
"webpack": "4.16.3",
"webpack-dev-middleware": "3.1.3",
"webpack-hot-middleware": "2.22.2",
"webpack-sources": "1.1.0",
"webpackbar": "2.6.1",
"webpack": "4.17.1",
"webpack-dev-middleware": "3.2.0",
"webpack-hot-middleware": "2.22.3",
"webpack-sources": "1.2.0",
"webpackbar": "2.6.3",
"write-file-webpack-plugin": "4.3.2"
},
"devDependencies": {
Expand All @@ -131,8 +131,8 @@
"chromedriver": "2.32.3",
"clone": "2.1.1",
"coveralls": "2.13.1",
"cross-env": "5.0.5",
"express": "4.15.5",
"cross-env": "5.2.0",
"express": "4.16.3",
"fkill": "5.1.0",
"flatten": "1.0.2",
"flow-bin": "0.73.0",
Expand Down
Loading