How to use the @vuepress/shared-utils.env.isDebug function in @vuepress/shared-utils

To help you get started, we’ve selected a few @vuepress/shared-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vuepress / packages / @vuepress / core / lib / node / webpack / createClientConfig.js View on Github external
.plugin('optimize-css')
      .use(require('optimize-css-assets-webpack-plugin'), [{
        canPrint: false,
        cssProcessorOptions: {
          safe: true,
          autoprefixer: { disable: true },
          mergeLonghand: false
        }
      }])
  } else {
    config
      .plugin('hmr')
      .use(require('webpack/lib/HotModuleReplacementPlugin'))
  }

  if (!env.isDebug) {
    const WebpackBar = require('webpackbar')
    config
      .plugin('bar')
      .use(WebpackBar, [{
        name: 'Client',
        color: '#41b883',
        compiledIn: false
      }])
  }

  ctx.pluginAPI.applySyncOption('chainWebpack', config, false /* isServer */)

  return config
}
github vuejs / vuepress / packages / @vuepress / core / lib / node / webpack / createServerConfig.js View on Github external
config
    .plugin('ssr-server')
    .use(VueSSRServerPlugin, [{
      filename: 'manifest/server.json'
    }])

  const publicDir = path.resolve(sourceDir, '.vuepress/public')
  if (fs.existsSync(publicDir)) {
    config
      .plugin('copy')
      .use(CopyPlugin, [[
        { from: publicDir, to: outDir }
      ]])
  }

  if (!env.isDebug) {
    const WebpackBar = require('webpackbar')
    config
      .plugin('bar')
      .use(WebpackBar, [{
        name: 'Server',
        color: 'blue',
        compiledIn: false
      }])
  }

  ctx.pluginAPI.applySyncOption('chainWebpack', config, true /* isServer */)

  return config
}
github vuejs / vuepress / packages / @vuepress / core / lib / build.js View on Github external
webpack(config, (err, stats) => {
        if (err) {
          return reject(err)
        }
        if (stats.hasErrors()) {
          stats.toJson().errors.forEach(err => {
            console.error(err)
          })
          reject(new Error(`Failed to compile with errors.`))
          return
        }
        if (env.isDebug && stats.hasWarnings()) {
          stats.toJson().warnings.forEach(warning => {
            console.warn(warning)
          })
        }
        resolve(stats.toJson({ modules: false }))
      })
    })
github vuejs / vuepress / packages / @vuepress / core / lib / node / build / index.js View on Github external
webpack(config, (err, stats) => {
      if (err) {
        return reject(err)
      }
      if (stats.hasErrors()) {
        stats.toJson().errors.forEach(err => {
          console.error(err)
        })
        reject(new Error(`Failed to compile with errors.`))
        return
      }
      if (env.isDebug && stats.hasWarnings()) {
        stats.toJson().warnings.forEach(warning => {
          console.warn(warning)
        })
      }
      resolve(stats.toJson({ modules: false }))
    })
  })
github vuejs / vuepress / packages / @vuepress / core / lib / node / webpack / createBaseConfig.js View on Github external
const CSSExtractPlugin = require('mini-css-extract-plugin')

  const isProd = process.env.NODE_ENV === 'production'
  const inlineLimit = 10000

  const config = new Config()
  const extractHeaders = siteConfig.markdown && siteConfig.markdown.extractHeaders

  config
    .mode(isProd && !env.isDebug ? 'production' : 'development')
    .output
      .path(outDir)
      .filename(isProd ? 'assets/js/[name].[chunkhash:8].js' : 'assets/js/[name].js')
      .publicPath(publicPath)

  if (env.isDebug) {
    config.devtool('source-map')
  } else if (!isProd) {
    config.devtool('cheap-module-eval-source-map')
  }

  const modulePaths = getModulePaths()
  const clientDir = context.getLibFilePath('client')

  config.resolve
    .set('symlinks', true)
    .alias
      .set('@source', sourceDir)
      .set('@client', clientDir)
      .set('@app', clientDir)
      .set('@temp', tempPath)
      .set('@dynamic', path.resolve(tempPath, 'dynamic'))
github vuejs / vuepress / packages / @vuepress / core / lib / node / webpack / createBaseConfig.js View on Github external
},
    pluginAPI
  } = context

  const Config = require('webpack-chain')
  const { VueLoaderPlugin } = require('vue-loader')
  const CSSExtractPlugin = require('mini-css-extract-plugin')

  const isProd = process.env.NODE_ENV === 'production'
  const inlineLimit = 10000

  const config = new Config()
  const extractHeaders = siteConfig.markdown && siteConfig.markdown.extractHeaders

  config
    .mode(isProd && !env.isDebug ? 'production' : 'development')
    .output
      .path(outDir)
      .filename(isProd ? 'assets/js/[name].[chunkhash:8].js' : 'assets/js/[name].js')
      .publicPath(publicPath)

  if (env.isDebug) {
    config.devtool('source-map')
  } else if (!isProd) {
    config.devtool('cheap-module-eval-source-map')
  }

  const modulePaths = getModulePaths()
  const clientDir = context.getLibFilePath('client')

  config.resolve
    .set('symlinks', true)