Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.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
}
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
}
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 }))
})
})
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 }))
})
})
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'))
},
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)