fix(server): Fix for next.js output file tracing.

This commit is contained in:
Sam 2022-06-18 23:09:13 +02:00
parent 51bc05f835
commit 34c3f2d91a
No known key found for this signature in database
GPG Key ID: D004126FCD1A6DF0
5 changed files with 13 additions and 5 deletions

View File

@ -30,6 +30,7 @@ module.exports = withLess({
// experimental: {
// concurrentFeatures: true,
// },
outputFileTracing: true,
eslint: {
ignoreDuringBuilds: true,
},

View File

@ -13,13 +13,14 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
import path from 'path';
import { createApiContext, getPageConfig, getRootConfig } from '@lowdefy/api';
import Page from '../lib/Page.js';
export async function getStaticProps() {
const apiContext = await createApiContext({ buildDirectory: './build' });
// Important to give absolute path so Next can trace build files
const apiContext = await createApiContext({ buildDirectory: path.join(process.cwd(), 'build') });
const [rootConfig, pageConfig] = await Promise.all([
getRootConfig(apiContext),

View File

@ -14,6 +14,7 @@
limitations under the License.
*/
import path from 'path';
import { createApiContext, getPageConfig, getRootConfig } from '@lowdefy/api';
import getServerSession from '../lib/auth/getServerSession.js';
@ -22,8 +23,9 @@ import Page from '../lib/Page.js';
export async function getServerSideProps(context) {
const { pageId } = context.params;
const session = await getServerSession(context);
// Important to give absolute path so Next can trace build files
const apiContext = await createApiContext({
buildDirectory: './build',
buildDirectory: path.join(process.cwd(), 'build'),
logger: console,
session,
});

View File

@ -14,6 +14,7 @@
limitations under the License.
*/
import path from 'path';
import { callRequest, createApiContext } from '@lowdefy/api';
import { getSecretsFromEnv } from '@lowdefy/node-utils';
@ -28,8 +29,9 @@ export default async function handler(req, res) {
throw new Error('Only POST requests are supported.');
}
const session = await getServerSession({ req });
// Important to give absolute path so Next can trace build files
const apiContext = await createApiContext({
buildDirectory: './build',
buildDirectory: path.join(process.cwd(), 'build'),
connections,
// logger: console,
logger: { debug: () => {} },

View File

@ -14,6 +14,7 @@
limitations under the License.
*/
import path from 'path';
import { createApiContext, getPageConfig, getRootConfig } from '@lowdefy/api';
import getServerSession from '../lib/auth/getServerSession.js';
@ -22,8 +23,9 @@ import Page from '../lib/Page.js';
export async function getServerSideProps(context) {
const session = await getServerSession(context);
// Important to give absolute path so Next can trace build files
const apiContext = await createApiContext({
buildDirectory: './build',
buildDirectory: path.join(process.cwd(), 'build'),
logger: console,
session,
});