mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
change build directories structure
This commit is contained in:
parent
3c88a3d7a8
commit
fb6f5d4382
|
@ -11,12 +11,12 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
|
|||
const entry = {}
|
||||
const defaultEntries = hotReload ? ['webpack/hot/only-dev-server'] : []
|
||||
for (const p of pages) {
|
||||
entry[join('_bundles', p)] = defaultEntries.concat(['./' + p])
|
||||
entry[join('bundles', p)] = defaultEntries.concat(['./' + p])
|
||||
}
|
||||
|
||||
const errEntry = join('_bundles', 'pages', '_error.js')
|
||||
const errorEntry = join('bundles', 'pages', '_error.js')
|
||||
const defaultErrorPath = resolve(__dirname, '..', '..', 'pages', '_error.js')
|
||||
if (!entry[errEntry]) entry[errEntry] = defaultErrorPath
|
||||
if (!entry[errorEntry]) entry[errorEntry] = defaultErrorPath
|
||||
|
||||
const nodeModulesDir = resolve(__dirname, '..', '..', '..', 'node_modules')
|
||||
|
||||
|
@ -42,7 +42,7 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
|
|||
],
|
||||
exclude: /node_modules/,
|
||||
query: {
|
||||
name: '[path][name].[ext]'
|
||||
name: 'dist/[path][name].[ext]'
|
||||
}
|
||||
}, {
|
||||
test: /\.js$/,
|
||||
|
@ -118,7 +118,7 @@ export default async function createCompiler (dir, { hotReload = false } = {}) {
|
|||
},
|
||||
customInterpolateName: function (url, name, opts) {
|
||||
if (defaultErrorPath === this.resourcePath) {
|
||||
return 'pages/_error.js'
|
||||
return 'dist/pages/_error.js'
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ export async function render (url, ctx = {}, {
|
|||
staticMarkup = false
|
||||
} = {}) {
|
||||
const path = getPath(url)
|
||||
const mod = await requireModule(resolve(dir, '.next', 'pages', path))
|
||||
const mod = await requireModule(resolve(dir, '.next', 'dist', 'pages', path))
|
||||
const Component = mod.default || mod
|
||||
|
||||
const props = await (Component.getInitialProps ? Component.getInitialProps(ctx) : {})
|
||||
const component = await read(resolve(dir, '.next', '_bundles', 'pages', path))
|
||||
const component = await read(resolve(dir, '.next', 'bundles', 'pages', path))
|
||||
|
||||
const { html, css } = StyleSheetServer.renderStatic(() => {
|
||||
const app = createElement(App, {
|
||||
|
@ -53,7 +53,7 @@ export async function render (url, ctx = {}, {
|
|||
|
||||
export async function renderJSON (url, { dir = process.cwd() } = {}) {
|
||||
const path = getPath(url)
|
||||
const component = await read(resolve(dir, '.next', '_bundles', 'pages', path))
|
||||
const component = await read(resolve(dir, '.next', 'bundles', 'pages', path))
|
||||
return { component }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue