diff --git a/Gulpfile.mjs b/Gulpfile.mjs index 2ab5d21b0060..64934f1bc376 100644 --- a/Gulpfile.mjs +++ b/Gulpfile.mjs @@ -671,16 +671,6 @@ gulp.task( ) ); -function watch() { - gulp.watch(defaultSourcesGlob, gulp.task("build-no-bundle-watch")); - gulp.watch(babelStandalonePluginConfigGlob, gulp.task("generate-standalone")); - gulp.watch(buildTypingsWatchGlob, gulp.task("generate-type-helpers")); - gulp.watch( - "./packages/babel-helpers/src/helpers/*.js", - gulp.task("generate-runtime-helpers") - ); -} - function watch() { gulp.watch(defaultSourcesGlob, gulp.task("build-no-bundle-watch")); gulp.watch(babelStandalonePluginConfigGlob, gulp.task("generate-standalone")); diff --git a/Makefile.mjs b/Makefile.mjs index 567788439db0..caf62baa702d 100644 --- a/Makefile.mjs +++ b/Makefile.mjs @@ -125,6 +125,18 @@ target["clean-runtime-helpers"] = function () { * BUILD */ +target["use-cjs"] = function () { + node(["scripts/set-module-type.js", "script"]); + + target["bootstrap"](); +}; + +target["use-esm"] = function () { + node(["scripts/set-module-type.js", "module"]); + + target["bootstrap"](); +}; + target["bootstrap-only"] = function () { target["clean-all"](); @@ -151,6 +163,8 @@ target["build-standalone"] = function () { }; target["build-bundle"] = function () { + node(["scripts/set-module-type.js"]); + target["clean"](); target["clean-lib"](); @@ -161,6 +175,8 @@ target["build-bundle"] = function () { }; target["build-no-bundle"] = function () { + node(["scripts/set-module-type.js"]); + target["clean"](); target["clean-lib"](); diff --git a/scripts/set-module-type.js b/scripts/set-module-type.js index fe5b7dd25fd6..fa4dce6ff1dc 100755 --- a/scripts/set-module-type.js +++ b/scripts/set-module-type.js @@ -1,8 +1,11 @@ #!/usr/bin/env node import fs from "fs"; +import { fileURLToPath } from "url"; +import path from "path"; -const root = rel => new URL(`../${rel}`, import.meta.url).pathname; +const root = rel => + path.join(fileURLToPath(path.dirname(import.meta.url)), "../", rel); // prettier-ignore let moduleType;