mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
suppress logging on test (#455)
This commit is contained in:
parent
f1c6ea3248
commit
4faa281f23
|
@ -11,7 +11,7 @@ import DynamicEntryPlugin from './plugins/dynamic-entry-plugin'
|
||||||
import DetachPlugin from './plugins/detach-plugin'
|
import DetachPlugin from './plugins/detach-plugin'
|
||||||
import getConfig from '../config'
|
import getConfig from '../config'
|
||||||
|
|
||||||
export default async function createCompiler (dir, { dev = false } = {}) {
|
export default async function createCompiler (dir, { dev = false, quiet = false } = {}) {
|
||||||
dir = resolve(dir)
|
dir = resolve(dir)
|
||||||
|
|
||||||
const pages = await glob('pages/**/*.js', {
|
const pages = await glob('pages/**/*.js', {
|
||||||
|
@ -66,9 +66,11 @@ export default async function createCompiler (dir, { dev = false } = {}) {
|
||||||
new DynamicEntryPlugin(),
|
new DynamicEntryPlugin(),
|
||||||
new UnlinkFilePlugin(),
|
new UnlinkFilePlugin(),
|
||||||
new WatchRemoveEventPlugin(),
|
new WatchRemoveEventPlugin(),
|
||||||
new WatchPagesPlugin(dir),
|
new WatchPagesPlugin(dir)
|
||||||
new FriendlyErrorsWebpackPlugin()
|
|
||||||
)
|
)
|
||||||
|
if (!quiet) {
|
||||||
|
plugins.push(new FriendlyErrorsWebpackPlugin())
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
plugins.push(
|
plugins.push(
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
|
|
|
@ -8,8 +8,9 @@ import babel, { watch } from './build/babel'
|
||||||
import read from './read'
|
import read from './read'
|
||||||
|
|
||||||
export default class HotReloader {
|
export default class HotReloader {
|
||||||
constructor (dir) {
|
constructor (dir, { quiet } = {}) {
|
||||||
this.dir = dir
|
this.dir = dir
|
||||||
|
this.quiet = quiet
|
||||||
this.middlewares = []
|
this.middlewares = []
|
||||||
this.webpackDevMiddleware = null
|
this.webpackDevMiddleware = null
|
||||||
this.webpackHotMiddleware = null
|
this.webpackHotMiddleware = null
|
||||||
|
@ -38,7 +39,7 @@ export default class HotReloader {
|
||||||
this.watch()
|
this.watch()
|
||||||
|
|
||||||
const [compiler] = await Promise.all([
|
const [compiler] = await Promise.all([
|
||||||
webpack(this.dir, { dev: true }),
|
webpack(this.dir, { dev: true, quiet: this.quiet }),
|
||||||
clean(this.dir)
|
clean(this.dir)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ export default class Server {
|
||||||
this.quiet = quiet
|
this.quiet = quiet
|
||||||
this.renderOpts = { dir: this.dir, dev, staticMarkup }
|
this.renderOpts = { dir: this.dir, dev, staticMarkup }
|
||||||
this.router = new Router()
|
this.router = new Router()
|
||||||
this.hotReloader = dev ? new HotReloader(this.dir) : null
|
this.hotReloader = dev ? new HotReloader(this.dir, { quiet }) : null
|
||||||
this.http = null
|
this.http = null
|
||||||
this.config = getConfig(dir)
|
this.config = getConfig(dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue