Always load the CJS helpers when using require (#12865)
This commit is contained in:
@@ -139,17 +139,23 @@ function writeHelpers(runtimeName, { corejs } = {}) {
|
||||
for (const helperName of helpers.list) {
|
||||
const helperPath = path.join("helpers", helperName);
|
||||
helperSubExports[`./${helperPath}`] = {
|
||||
module: writeHelperFile(runtimeName, pkgDirname, helperPath, helperName, {
|
||||
esm: true,
|
||||
corejs,
|
||||
}),
|
||||
node: writeHelperFile(runtimeName, pkgDirname, helperPath, helperName, {
|
||||
esm: false,
|
||||
corejs,
|
||||
}),
|
||||
get default() {
|
||||
return this.module;
|
||||
get node() {
|
||||
return this.require;
|
||||
},
|
||||
require: writeHelperFile(
|
||||
runtimeName,
|
||||
pkgDirname,
|
||||
helperPath,
|
||||
helperName,
|
||||
{ esm: false, corejs }
|
||||
),
|
||||
default: writeHelperFile(
|
||||
runtimeName,
|
||||
pkgDirname,
|
||||
helperPath,
|
||||
helperName,
|
||||
{ esm: true, corejs }
|
||||
),
|
||||
};
|
||||
writeHelperLegacyESMFile(pkgDirname, helperName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user