1
1
mirror of https://github.com/primer/css.git synced 2024-12-01 04:21:12 +03:00
css/docs/next.config.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

// this runs synchronously
2018-12-05 00:37:31 +03:00
// require('./copy')
const {join, resolve} = require('path')
const withPlugins = require('next-compose-plugins')
2018-12-05 00:53:49 +03:00
const configure = require('./lib/config')
2018-12-05 03:32:55 +03:00
const css = require('@zeit/next-css')
const pageExtensions = ['js', 'jsx', 'md', 'mdx']
const assetPrefix = process.env.NOW_URL
2018-12-05 00:37:31 +03:00
module.exports = withPlugins([
2018-12-05 03:32:55 +03:00
css(),
2018-12-05 00:53:49 +03:00
configure()
2018-12-05 00:37:31 +03:00
], {
/*
* Note: Prefixing assets with the fully qualified deployment URL
* makes them available even when the site is served from a path alias, as in
* <https://primer.style/components>
*/
assetPrefix: process.env.NOW_URL,
pageExtensions,
publicRuntimeConfig: {
assetPrefix
},
webpack(config, {dev}) {
const {optimization} = config
if (optimization && Array.isArray(optimization.minimizer)) {
const terserPlugin = optimization.minimizer[0]
/* eslint-disable camelcase, no-console */
console.warn('*** disabling mangling in Terser plugin ***')
terserPlugin.options.terserOptions = {
keep_fnames: true
}
/* eslint-enable camelcase, no-console */
}
return config
}
})