8221c180a5
This upgrades to ncc@0.25.0 and fixes the previous bugs including: * ncc not referenced correctly in build * Babel type errors * node-fetch, etag, chalk and raw-body dependencies not building with ncc - these have been "un-ncc'd" for now. As they are relatively small dependencies, this doesn't seem too much of an issue and we can follow up in the tracking ncc issue at https://github.com/vercel/ncc/issues/612. * `yarn dev` issues Took a lot of bisecting, but the overall diff isn't too bad here in the end.
18 lines
680 B
TypeScript
18 lines
680 B
TypeScript
import { NodePath, PluginObj, types } from 'next/dist/compiled/babel/core'
|
|
|
|
export default function NextPageDisallowReExportAllExports(): PluginObj<any> {
|
|
return {
|
|
visitor: {
|
|
ExportAllDeclaration(path: NodePath<types.ExportAllDeclaration>) {
|
|
const err = new SyntaxError(
|
|
`Using \`export * from '...'\` in a page is disallowed. Please use \`export { default } from '...'\` instead.\n` +
|
|
`Read more: https://err.sh/next.js/export-all-in-page`
|
|
)
|
|
;(err as any).code = 'BABEL_PARSE_ERROR'
|
|
;(err as any).loc =
|
|
path.node.loc?.start ?? path.node.loc?.end ?? path.node.loc
|
|
throw err
|
|
},
|
|
},
|
|
}
|
|
}
|