Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dev): build modules for ts->js conversion #4891

Merged
merged 2 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/many-zebras-arrive.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions packages/remix-dev/cli/migrate/migrations/transforms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// escape-hatch to include these files in the build
export * as ConvertToJavaScriptTransform from "./convert-to-javascript/transform";
20 changes: 20 additions & 0 deletions packages/remix-dev/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down