Commit c81bd275 authored by JJ Kasper's avatar JJ Kasper Committed by Joe Haddad

Fix relative next path not working in webpack config (#6667)

* Fix relative next path not working in
webpack config

* Also add relative fix to amp path
parent d7ab018f
......@@ -41,7 +41,7 @@ export default function getBaseWebpackConfig (dir: string, {dev = false, isServe
// Backwards compatibility
'main.js': [],
[CLIENT_STATIC_FILES_RUNTIME_MAIN]: [
path.relative(dir, path.join(NEXT_PROJECT_ROOT_DIST_CLIENT, (dev ? `next-dev` : 'next')))
`.${path.sep}` + path.relative(dir, path.join(NEXT_PROJECT_ROOT_DIST_CLIENT, (dev ? `next-dev` : 'next')))
].filter(Boolean)
} : undefined
......
import { relative as relativePath, join, normalize } from 'path'
import { relative as relativePath, join, normalize, sep } from 'path'
import WebpackDevMiddleware from 'webpack-dev-middleware'
import WebpackHotMiddleware from 'webpack-hot-middleware'
import errorOverlayMiddleware from './lib/error-overlay-middleware'
......@@ -174,7 +174,7 @@ export default class HotReloader {
let additionalClientEntrypoints = {}
if (this.config.experimental.amp) {
additionalClientEntrypoints[CLIENT_STATIC_FILES_RUNTIME_AMP] = relativePath(this.dir, join(NEXT_PROJECT_ROOT_DIST_CLIENT, 'amp-dev'))
additionalClientEntrypoints[CLIENT_STATIC_FILES_RUNTIME_AMP] = `.${sep}` + relativePath(this.dir, join(NEXT_PROJECT_ROOT_DIST_CLIENT, 'amp-dev'))
}
return [
......
Markdown is supported
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