From 84a9c49c8e1e4c0132469aa3318cbff0c58f0a59 Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Fri, 16 Dec 2022 11:22:46 -0500 Subject: [PATCH 1/2] fix(dev): build js modules for ts->js conversion The TS->JS migration was removed from the CLI codemod options, but still used for TS->JS conversion when creating a new Remix project from the CLI. The TS modules responsible for the TS->JS conversion were incorrectly removed from the Rollup build, resulting in the corresponding built JS modules being absent. That caused the CLI to error when trying to perform TS->JS conversion. This changes reintroduces the wiring to build the modules responsible for the TS->JS conversion. Fixes #4854 --- .../cli/migrate/migrations/transforms.ts | 2 ++ packages/remix-dev/rollup.config.js | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 packages/remix-dev/cli/migrate/migrations/transforms.ts diff --git a/packages/remix-dev/cli/migrate/migrations/transforms.ts b/packages/remix-dev/cli/migrate/migrations/transforms.ts new file mode 100644 index 00000000000..89cfa4616a8 --- /dev/null +++ b/packages/remix-dev/cli/migrate/migrations/transforms.ts @@ -0,0 +1,2 @@ +// escape-hatch to include these files in the build +export * as ConvertToJavaScriptTransform from "./convert-to-javascript/transform"; diff --git a/packages/remix-dev/rollup.config.js b/packages/remix-dev/rollup.config.js index 39c01b3de4f..6bb4b9ab048 100644 --- a/packages/remix-dev/rollup.config.js +++ b/packages/remix-dev/rollup.config.js @@ -71,6 +71,26 @@ module.exports = function rollup() { ], }, getCliConfig({ packageName, version }), + { + external: (id) => isBareModuleId(id), + input: [`${sourceDir}/cli/migrate/migrations/transforms.ts`], + output: { + banner: createBanner("@remix-run/dev", version), + dir: `${outputDist}/cli/migrate/migrations`, + exports: "named", + format: "cjs", + preserveModules: true, + }, + plugins: [ + babel({ + babelHelpers: "bundled", + exclude: /node_modules/, + extensions: [".ts"], + }), + nodeResolve({ extensions: [".ts"] }), + copyToPlaygrounds(), + ], + }, { external() { return true; From a63be3983fdb0ffc8184d3af1c1bb97478140a47 Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Fri, 16 Dec 2022 11:44:57 -0500 Subject: [PATCH 2/2] Create many-zebras-arrive.md --- .changeset/many-zebras-arrive.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .changeset/many-zebras-arrive.md diff --git a/.changeset/many-zebras-arrive.md b/.changeset/many-zebras-arrive.md new file mode 100644 index 00000000000..6617a9bfbbb --- /dev/null +++ b/.changeset/many-zebras-arrive.md @@ -0,0 +1,14 @@ +--- +"@remix-run/dev": patch +--- + +Fix TS->JS conversion when creating a new Remix project via the CLI + +The TS->JS migration was removed from the CLI codemod options, but still +used for TS->JS conversion when creating a new Remix project from the +CLI. The TS modules responsible for the TS->JS conversion were +incorrectly removed from the Rollup build, resulting in the +corresponding built JS modules being absent. That caused the CLI to +error when trying to perform TS->JS conversion. This changes +reintroduces the wiring to build the modules responsible for the TS->JS +conversion.