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

Merge master into next-export.

This commit is contained in:
Arunoda Susiripala 2017-05-15 09:15:50 +05:30
commit 55c7553a98
6 changed files with 34 additions and 11 deletions

View file

@ -0,0 +1,9 @@
module.exports = {
webpack: function (config) {
if (config.resolve.alias) {
delete config.resolve.alias['react']
delete config.resolve.alias['react-dom']
}
return config
}
}

View file

@ -1,7 +1,6 @@
{ {
"presets": [ "presets": [
"next/babel", "next/babel"
"stage-0"
], ],
"plugins": [ "plugins": [
["styled-components", { "ssr": true, "displayName": true, "preprocess": false } ] ["styled-components", { "ssr": true, "displayName": true, "preprocess": false } ]

View file

@ -79,7 +79,7 @@
"mz": "2.6.0", "mz": "2.6.0",
"path-match": "1.2.4", "path-match": "1.2.4",
"pkg-up": "2.0.0", "pkg-up": "2.0.0",
"prop-types": "15.5.9", "prop-types": "15.5.10",
"react-hot-loader": "3.0.0-beta.6", "react-hot-loader": "3.0.0-beta.6",
"send": "0.15.2", "send": "0.15.2",
"source-map-support": "0.4.15", "source-map-support": "0.4.15",
@ -96,7 +96,7 @@
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "7.2.3", "babel-eslint": "7.2.3",
"babel-jest": "18.0.0", "babel-jest": "20.0.1",
"babel-plugin-istanbul": "4.1.3", "babel-plugin-istanbul": "4.1.3",
"babel-plugin-transform-remove-strict-mode": "0.0.2", "babel-plugin-transform-remove-strict-mode": "0.0.2",
"babel-preset-es2015": "6.24.1", "babel-preset-es2015": "6.24.1",
@ -106,13 +106,14 @@
"coveralls": "2.13.1", "coveralls": "2.13.1",
"cross-env": "4.0.0", "cross-env": "4.0.0",
"express": "4.15.2", "express": "4.15.2",
"cross-env": "5.0.0",
"fly": "2.0.6", "fly": "2.0.6",
"fly-babel": "2.1.1", "fly-babel": "2.1.1",
"fly-clear": "1.0.1", "fly-clear": "1.0.1",
"fly-esnext": "2.0.1", "fly-esnext": "2.0.1",
"fly-watch": "1.1.1", "fly-watch": "1.1.1",
"husky": "0.13.3", "husky": "0.13.3",
"jest-cli": "19.0.1", "jest-cli": "20.0.1",
"lint-staged": "^3.4.0", "lint-staged": "^3.4.0",
"node-fetch": "1.6.3", "node-fetch": "1.6.3",
"node-notifier": "5.1.2", "node-notifier": "5.1.2",

View file

@ -683,9 +683,15 @@ In order to extend our usage of `webpack`, you can define a function that extend
module.exports = { module.exports = {
webpack: (config, { dev }) => { webpack: (config, { dev }) => {
   // Perform customizations to config // Perform customizations to webpack config
   
   // Important: return the modified config // Important: return the modified config
return config
},
webpackDevMiddleware: (config) => {
// Perform customizations to webpack dev middleware config
// Important: return the modified config
return config return config
} }
} }

View file

@ -5,6 +5,7 @@ const cache = new Map()
const defaultConfig = { const defaultConfig = {
webpack: null, webpack: null,
webpackDevMiddleware: null,
poweredByHeader: true, poweredByHeader: true,
distDir: '.next', distDir: '.next',
assetPrefix: '' assetPrefix: ''

View file

@ -138,14 +138,21 @@ export default class HotReloader {
} }
} : {} } : {}
this.webpackDevMiddleware = webpackDevMiddleware(compiler, { let webpackDevMiddlewareConfig = {
publicPath: '/_next/webpack/', publicPath: '/_next/webpack/',
noInfo: true, noInfo: true,
quiet: true, quiet: true,
clientLogLevel: 'warning', clientLogLevel: 'warning',
watchOptions: { ignored }, watchOptions: { ignored },
...windowsSettings ...windowsSettings
}) }
if (this.config.webpackDevMiddleware) {
console.log('> Using "webpackDevMiddleware" config function defined in next.config.js.')
webpackDevMiddlewareConfig = this.config.webpackDevMiddleware(webpackDevMiddlewareConfig)
}
this.webpackDevMiddleware = webpackDevMiddleware(compiler, webpackDevMiddlewareConfig)
this.webpackHotMiddleware = webpackHotMiddleware(compiler, { this.webpackHotMiddleware = webpackHotMiddleware(compiler, {
path: '/_next/webpack-hmr', path: '/_next/webpack-hmr',