Unverified Commit 6d6ce94f authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

An empty `jsconfig.json` should not fail the build (#13051)

parent 3b382a08
...@@ -65,7 +65,13 @@ const escapePathVariables = (value: any) => { ...@@ -65,7 +65,13 @@ const escapePathVariables = (value: any) => {
function parseJsonFile(path: string) { function parseJsonFile(path: string) {
const JSON5 = require('next/dist/compiled/json5') const JSON5 = require('next/dist/compiled/json5')
const contents = readFileSync(path) const contents = readFileSync(path, 'utf8')
// Special case an empty file
if (contents.trim() === '') {
return {}
}
try { try {
return JSON5.parse(contents) return JSON5.parse(contents)
} catch (err) { } catch (err) {
......
module.exports = {
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60,
},
}
export default function Abc() {
return <div />
}
/* eslint-env jest */
import { nextBuild } from 'next-test-utils'
import { join } from 'path'
jest.setTimeout(1000 * 60 * 2)
const appDir = join(__dirname, '..')
describe('Empty JSConfig Support', () => {
test('should compile successfully', async () => {
const { code, stdout } = await nextBuild(appDir, [], {
stdout: true,
})
expect(code).toBe(0)
expect(stdout).toMatch(/Compiled successfully/)
})
})
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