Unverified Commit 2d1cb8fe authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure @babel/core is not duplicated (#28716)

Follow-up to https://github.com/vercel/next.js/pull/28713 this ensures we also don't duplicate `@babel/core` in our `babel-packages` bundle. This was occurring from us re-using the `@babel/core` package name which causes us to remove it from the externals [here](https://github.com/vercel/next.js/blob/77c0e0937128409960ee48ee965501f4d18c9c82/packages/next/taskfile-ncc.js#L18-L21).
parent 77c0e093
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{"name":"@babel/core","main":"packages-bundle.js","author":"The Babel Team (https://babel.dev/team)","license":"MIT"} {"name":"babel-packages","main":"./packages-bundle.js"}
\ No newline at end of file
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
const notifier = require('node-notifier') const notifier = require('node-notifier')
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
const { relative, basename, resolve } = require('path') const { relative, basename, resolve, join } = require('path')
const { Module } = require('module') const { Module } = require('module')
const fs = require('fs')
// Note: // Note:
// "bundles" folder shadows main node_modules in workspace where all installs in // "bundles" folder shadows main node_modules in workspace where all installs in
...@@ -155,12 +156,15 @@ export async function ncc_babel_bundle_packages(task, opts) { ...@@ -155,12 +156,15 @@ export async function ncc_babel_bundle_packages(task, opts) {
await task await task
.source(opts.src || 'bundles/babel/packages-bundle.js') .source(opts.src || 'bundles/babel/packages-bundle.js')
.ncc({ .ncc({
packageName: `@babel/core`,
bundleName: 'babel-packages',
externals: externals, externals: externals,
}) })
.target(`compiled/babel-packages`) .target(`compiled/babel-packages`)
await fs.promises.writeFile(
join(__dirname, 'compiled/babel-packages/package.json'),
JSON.stringify({ name: 'babel-packages', main: './packages-bundle.js' })
)
await task await task
.source(opts.src || 'bundles/babel/packages/*') .source(opts.src || 'bundles/babel/packages/*')
.target('compiled/babel') .target('compiled/babel')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment