Disable Comment Extraction (#12496)

This commit is contained in:
Joe Haddad 2020-05-05 11:39:36 -04:00 committed by GitHub
parent f024814057
commit 48140d5bb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -640,6 +640,7 @@ export default async function getBaseWebpackConfig(
minimizer: [
// Minify JavaScript
new TerserPlugin({
extractComments: false,
cache: path.join(distDir, 'cache', 'next-minifier'),
parallel: config.experimental.cpus || true,
terserOptions,

View file

@ -1,3 +1,4 @@
/*! DO NOT EXTRACT ME */
export default function() {
return <div />
}

View file

@ -4,6 +4,7 @@ import 'flat-map-polyfill'
import { remove } from 'fs-extra'
import { nextBuild } from 'next-test-utils'
import { join } from 'path'
import { recursiveReadDir } from 'next/dist/lib/recursive-readdir'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
@ -34,6 +35,14 @@ describe('Build Output', () => {
expect(stdout).toContain('○ /')
})
it('should not emit extracted comments', async () => {
const files = await recursiveReadDir(
join(appDir, '.next'),
/\.txt|\.LICENSE\./
)
expect(files).toEqual([])
})
})
describe('Custom App Output', () => {