Skip to content

Commit fb6f5d4

Browse files
committed
change build directories structure
1 parent 3c88a3d commit fb6f5d4

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

server/build/webpack.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
1111
const entry = {}
1212
const defaultEntries = hotReload ? ['webpack/hot/only-dev-server'] : []
1313
for (const p of pages) {
14-
entry[join('_bundles', p)] = defaultEntries.concat(['./' + p])
14+
entry[join('bundles', p)] = defaultEntries.concat(['./' + p])
1515
}
1616

17-
const errEntry = join('_bundles', 'pages', '_error.js')
17+
const errorEntry = join('bundles', 'pages', '_error.js')
1818
const defaultErrorPath = resolve(__dirname, '..', '..', 'pages', '_error.js')
19-
if (!entry[errEntry]) entry[errEntry] = defaultErrorPath
19+
if (!entry[errorEntry]) entry[errorEntry] = defaultErrorPath
2020

2121
const nodeModulesDir = resolve(__dirname, '..', '..', '..', 'node_modules')
2222

@@ -42,7 +42,7 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
4242
],
4343
exclude: /node_modules/,
4444
query: {
45-
name: '[path][name].[ext]'
45+
name: 'dist/[path][name].[ext]'
4646
}
4747
}, {
4848
test: /\.js$/,
@@ -118,7 +118,7 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
118118
},
119119
customInterpolateName: function (url, name, opts) {
120120
if (defaultErrorPath === this.resourcePath) {
121-
return 'pages/_error.js'
121+
return 'dist/pages/_error.js'
122122
}
123123
return url
124124
}

server/render.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export async function render (url, ctx = {}, {
1616
staticMarkup = false
1717
} = {}) {
1818
const path = getPath(url)
19-
const mod = await requireModule(resolve(dir, '.next', 'pages', path))
19+
const mod = await requireModule(resolve(dir, '.next', 'dist', 'pages', path))
2020
const Component = mod.default || mod
2121

2222
const props = await (Component.getInitialProps ? Component.getInitialProps(ctx) : {})
23-
const component = await read(resolve(dir, '.next', '_bundles', 'pages', path))
23+
const component = await read(resolve(dir, '.next', 'bundles', 'pages', path))
2424

2525
const { html, css } = StyleSheetServer.renderStatic(() => {
2626
const app = createElement(App, {
@@ -53,7 +53,7 @@ export async function render (url, ctx = {}, {
5353

5454
export async function renderJSON (url, { dir = process.cwd() } = {}) {
5555
const path = getPath(url)
56-
const component = await read(resolve(dir, '.next', '_bundles', 'pages', path))
56+
const component = await read(resolve(dir, '.next', 'bundles', 'pages', path))
5757
return { component }
5858
}
5959

0 commit comments

Comments
 (0)