Skip to content

Commit

Permalink
fix: use node:module import
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed Oct 2, 2023
1 parent 4aa6a41 commit 333355b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hot-pillows-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/sd-transforms': patch
---

Specify import to "module" as "node:module" for build tools to better understand it as a built-in.
2 changes: 1 addition & 1 deletion src/registerTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function registerTransforms(sd: Core, transformOpts?: TransformOpti
// NodeJS env and no passed SD? let's register on our installed SD
// We're in ESM, but style-dictionary is CJS only, so we need module.createRequire
if (!isBrowser && _sd === undefined) {
const module = await import('module');
const module = await import('node:module');
const mod = module.default;
const require = mod.createRequire(import.meta.url);
_sd = require('style-dictionary');
Expand Down

0 comments on commit 333355b

Please sign in to comment.