Skip to content

Commit

Permalink
Revert next.conifg.mjs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed Feb 15, 2024
1 parent 3ca0f73 commit 3d2b676
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
22 changes: 8 additions & 14 deletions docs/next.config.mjs → docs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
// @ts-check
import * as path from 'path';
import * as url from 'url';
import * as fs from 'fs';
const path = require('path');
const fs = require('fs');
// @ts-ignore
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { createRequire } from 'module';
import { findPages } from './src/modules/utils/find.mjs';

const currentDirectory = url.fileURLToPath(new URL('.', import.meta.url));
const require = createRequire(import.meta.url);

const withDocsInfra = require('./nextConfigDocsInfra.js');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { findPages } = require('./src/modules/utils/find');
const withDocsInfra = require('./nextConfigDocsInfra');
const {
LANGUAGES,
LANGUAGES_SSR,
LANGUAGES_IGNORE_PAGES,
LANGUAGES_IN_PROGRESS,
} = require('./config.js');
} = require('./config');

const workspaceRoot = path.join(currentDirectory, '../');
const workspaceRoot = path.join(__dirname, '../');

const l10nPRInNetlify = /^l10n_/.test(process.env.HEAD || '') && process.env.NETLIFY === 'true';
const vercelDeploy = Boolean(process.env.VERCEL);
Expand All @@ -29,7 +23,7 @@ const buildOnlyEnglishLocale = isDeployPreview && !l10nPRInNetlify && !vercelDep
const pkgContent = fs.readFileSync(path.resolve(workspaceRoot, 'package.json'), 'utf8');
const pkg = JSON.parse(pkgContent);

export default withDocsInfra({
module.exports = withDocsInfra({
webpack: (config, options) => {
const plugins = config.plugins.slice();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import * as fs from 'fs';
import * as url from 'url';
import * as path from 'path';

const currentDirectory = url.fileURLToPath(new URL('.', import.meta.url));
const fs = require('fs');
const path = require('path');

const pageRegex = /(\.js|\.tsx)$/;
const blackList = ['/.eslintrc', '/_document', '/_app'];
Expand All @@ -23,9 +20,9 @@ const blackList = ['/.eslintrc', '/_document', '/_app'];
* @returns {NextJSPage[]}
*/
// eslint-disable-next-line import/prefer-default-export
export function findPages(
function findPages(
options = {},
directory = path.resolve(currentDirectory, '../../../pages'),
directory = path.resolve(__dirname, '../../../pages'),
pages = [],
) {
fs.readdirSync(directory).forEach((item) => {
Expand Down Expand Up @@ -84,3 +81,5 @@ export function findPages(

return pages;
}

module.exports.findPages = findPages;
2 changes: 1 addition & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../tsconfig.json",
"include": ["next-env.d.ts", "types", "src", "pages", "data", "next.config.mjs"],
"include": ["next-env.d.ts", "types", "src", "pages", "data", "next.config.js"],
"compilerOptions": {
"allowJs": true,
"isolatedModules": true,
Expand Down

0 comments on commit 3d2b676

Please sign in to comment.