migrate require to ES6 imports

This commit is contained in:
Pooya Parsa 2017-06-18 14:05:00 +04:30
parent fa9bc9445b
commit 20f93b8b54
6 changed files with 16 additions and 9 deletions

View File

@ -11,10 +11,12 @@ import MFS from 'memory-fs'
import webpackDevMiddleware from 'webpack-dev-middleware'
import webpackHotMiddleware from 'webpack-hot-middleware'
import { r, wp, createRoutes, parallel } from 'utils'
import Debug from 'debug'
import Glob from 'glob'
import clientWebpackConfig from './webpack/client.config.js'
import serverWebpackConfig from './webpack/server.config.js'
const debug = require('debug')('nuxt:build')
const debug = Debug('nuxt:build')
debug.color = 2 // Force green color
const remove = pify(fs.remove)
@ -22,7 +24,7 @@ const readFile = pify(fs.readFile)
const utimes = pify(fs.utimes)
const writeFile = pify(fs.writeFile)
const mkdirp = pify(fs.mkdirp)
const glob = pify(require('glob'))
const glob = pify(Glob)
export default class Builder extends Tapable {
constructor (nuxt) {

View File

@ -5,8 +5,9 @@ import { resolve, join, dirname, sep } from 'path'
import { minify } from 'html-minifier'
import Tapable from 'tappable'
import { isUrl, promisifyRoute, waitFor, flatRoutes } from 'utils'
import Debug from 'debug'
const debug = require('debug')('nuxt:generate')
const debug = Debug('nuxt:generate')
const copy = pify(fs.copy)
const remove = pify(fs.remove)
const writeFile = pify(fs.writeFile)

View File

@ -3,6 +3,7 @@ import { defaults, cloneDeep } from 'lodash'
import { join, resolve } from 'path'
import webpack from 'webpack'
import { isUrl, urlJoin } from 'utils'
import autoprefixer from 'autoprefixer'
import vueLoaderConfig from './vue-loader.config'
import { styleLoader, extractStyles } from './helpers'
@ -19,7 +20,7 @@ export default function webpackBaseConfig ({ isClient, isServer }) {
if (!Array.isArray(this.options.build.postcss)) {
this.options.build.postcss = [
require('autoprefixer')({
autoprefixer({
browsers: ['last 3 versions']
})
]

View File

@ -4,8 +4,9 @@ import { uniq } from 'lodash'
import hash from 'hash-sum'
import Tapable from 'tappable'
import { chainFn, sequence } from 'utils'
import Debug from 'debug'
const debug = require('debug')('nuxt:module')
const debug = Debug('nuxt:module')
export default class ModuleContainer extends Tapable {
constructor (nuxt) {

View File

@ -11,9 +11,11 @@ import { resolve, join } from 'path'
import fs from 'fs-extra'
import { createBundleRenderer } from 'vue-server-renderer'
import { getContext, setAnsiColors, encodeHtml } from 'utils'
import Debug from 'debug'
const debug = require('debug')('nuxt:render')
const debug = Debug('nuxt:render')
debug.color = 4 // Force blue color
setAnsiColors(ansiHTML)
let jsdom = null

View File

@ -1,6 +1,6 @@
const http = require('http')
const connect = require('connect')
const path = require('path')
import http from 'http'
import connect from 'connect'
import path from 'path'
class Server {
constructor (nuxt) {