next.js
4bbf9b6c - Add `__nextjs_pure` helper (#57286)

Commit
2 years ago
Add `__nextjs_pure` helper (#57286) ### What? Safely drop `__nextjs_pure` from next internals in transform ```js import {__nextjs_pure} from 'next/dist/build/swc/helpers' __nextjs_pure(console.log("test!")) ``` becomes ```js /*#__PURE__*/ console.log("test!"); ``` so it will be dropped by the minifier - terser and swc minifier will both work. ### Why? Adding pure comments from JS world with swc transform is complex. This would be a helper for the case if we want to create "pure" expressions. ### How? Closes WEB-1829 --------- Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Author
Parents
Loading