Skip to content

Instantly share code, notes, and snippets.

@cj
Created December 14, 2021 17:09
Show Gist options
  • Save cj/c6d7a3b1fcf238073951762747c201ba to your computer and use it in GitHub Desktop.
Save cj/c6d7a3b1fcf238073951762747c201ba to your computer and use it in GitHub Desktop.
Remix Transpile Modules
diff --git a/node_modules/@remix-run/dev/compiler.js b/node_modules/@remix-run/dev/compiler.js
index 22c5ac0..bb8ae60 100644
--- a/node_modules/@remix-run/dev/compiler.js
+++ b/node_modules/@remix-run/dev/compiler.js
@@ -352,6 +352,7 @@ async function createServerBuild(config, options) {
} // allow importing css files for bundling / hashing from node_modules.
+ if (config.transpileModules.includes(id)) return false;
if (id.endsWith(".css")) return false;
return true;
}
diff --git a/node_modules/@remix-run/dev/config.js b/node_modules/@remix-run/dev/config.js
index 4e847ff..e6dd5d1 100644
--- a/node_modules/@remix-run/dev/config.js
+++ b/node_modules/@remix-run/dev/config.js
@@ -117,6 +117,8 @@ async function readConfig(remixRoot, serverMode = serverModes.ServerMode.Product
}
}
+ let transpileModules = appConfig.transpileModules || [];
+
return {
appDirectory,
cacheDirectory,
@@ -130,7 +132,8 @@ async function readConfig(remixRoot, serverMode = serverModes.ServerMode.Product
routes: routes$1,
serverBuildDirectory,
serverMode,
- mdx: appConfig.mdx
+ mdx: appConfig.mdx,
+ transpileModules
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment