Commit b883060a authored by Florian Pagnoux's avatar Florian Pagnoux
Browse files

Allow basename config

parent dd522b54
const withCSS = require('@zeit/next-css')
const loader = require('./server/loader')
const keyBy = require('lodash.keyby')
const webpack = require('webpack')
const { parsed: localEnv } = require('dotenv').config()
module.exports = withCSS({
cssModules: false,
......@@ -11,6 +13,7 @@ module.exports = withCSS({
use: 'js-yaml-loader',
},
)
config.plugins.push(new webpack.EnvironmentPlugin(localEnv))
return config
},
exportPathMap: () => {
......@@ -21,5 +24,6 @@ module.exports = withCSS({
keyBy(routes, 'route')
)
})
}
},
assetPrefix: localEnv.BASENAME || ""
})
import Document, { Head, Main, NextScript } from 'next/document'
const basename = process.env.BASENAME || ''
export default class MyDocument extends Document {
render() {
return (
<html>
<Head>
<link rel="stylesheet" href="https://www.ipp.eu/wp-content/themes/ipp/assets/css/global.min.css" />
<link rel="stylesheet" href="/_next/static/style.css" />
<link rel="stylesheet" href={`${basename}/_next/static/style.css`} />
</Head>
<body>
<Main />
......
......@@ -2021,6 +2021,10 @@ domutils@^1.5.1:
dom-serializer "0"
domelementtype "1"
dotenv@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.1.0.tgz#9853b6ca98292acb7dec67a95018fa40bccff42c"
duplexify@^3.4.2, duplexify@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.6.0.tgz#592903f5d80b38d037220541264d69a198fb3410"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment