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. 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;