-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Closed
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.
Description
Run next info
(available from version 12.0.8 and up)
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
Binaries:
Node: 16.13.0
npm: 8.1.0
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.0.8
react: 17.0.2
react-dom: 17.0.2
What version of Next.js are you using?
12.0.8
What version of Node.js are you using?
16.13.0
What browser are you using?
Chrome, Safari
What operating system are you using?
macOS
How are you deploying your application?
Other platform
Describe the Bug
Updating our application from Next 11 to Next 12 we noticed that generated js assets are generated ignoring the browserlist.
For instance, starting from this code:
const callAll = async function () {
console.log("OK HELLO!");
}
Building using Next 11 (minified version)
() => {!async function () {console.log('OK HELLO!')}(), new t})
Building using Next 12 (minified version)
var n, t = (n = e().
mark((function n () {
return e().
wrap((function (n) {
for (; ;) switch (n.prev = n.next) {
case 0:
console.log('OK HELLO!')
case 1:
case'end':
return n.stop()
}
}), n)
})), function () {
var t = this, r = arguments
return new Promise((function (o, e) {
var u = n.apply(t, r)
function c (n) {i(u, o, e, c, f, 'next', n)}
function f (n) {i(u, o, e, c, f, 'throw', n)}
c(void 0)
}))
})
Expected Behavior
should respect browserslist.
We discovered that the regression is due to replacing babel in favor of swc.
Forcing the use of babel, adding .babelrc file at the project root, the output files are converted as expected:
{
"presets": ["next/babel"],
"plugins": []
}
To Reproduce
- Go to this repo: https://github.com/ale-grosselle/nextjs-browserlist-regression
- navigate to "next11-chrome-94" folder, then run "npm install && npm run build"
- Go to ".next/static" folder and then search "Hello"
- You will find the async function
- navigate to "next12" folder, then run "npm install && npm run build"
- Go to ".next/static" folder and then search "Hello"
- You will find the same function transpiled (for ie11 basically)
Metadata
Metadata
Assignees
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.