Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental flag to force SWC transforms (#36789)
fixes #36763 fixes #36590 ## Feature - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - It hasn't been accepted for implementation, although that process isn't clear, and this is a pretty trivial fix. - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - This is somewhat inherent in the error log - [x] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint`
- Loading branch information
1 parent
7d52589
commit c7b2083
Showing
4 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { createNext } from 'e2e-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
import { renderViaHTTP } from 'next-test-utils' | ||
|
||
describe('swc warnings by default', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: { | ||
'pages/index.js': ` | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} | ||
`, | ||
'.babelrc': ` | ||
{ | ||
"presets": ["next/babel"] | ||
} | ||
`, | ||
}, | ||
dependencies: {}, | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should have warning', async () => { | ||
await renderViaHTTP(next.url, '/') | ||
expect(next.cliOutput).toContain( | ||
'Disabled SWC as replacement for Babel because of custom Babel configuration' | ||
) | ||
}) | ||
}) | ||
|
||
describe('can force swc', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
nextConfig: { | ||
experimental: { | ||
forceSwcTransforms: true, | ||
}, | ||
}, | ||
files: { | ||
'pages/index.js': ` | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} | ||
`, | ||
'.babelrc': ` | ||
{ | ||
"presets": ["next/babel"] | ||
} | ||
`, | ||
}, | ||
dependencies: {}, | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should not have warning', async () => { | ||
await renderViaHTTP(next.url, '/') | ||
expect(next.cliOutput).not.toContain( | ||
'Disabled SWC as replacement for Babel because of custom Babel configuration' | ||
) | ||
}) | ||
}) |