Skip to content

Commit

Permalink
chore: add webpack ignore statement to dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed Oct 6, 2023
1 parent ff2e99f commit 77b4f04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/red-gorillas-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/sd-transforms': patch
---

Add a webpack ignore statement to dynamic import of node builtin in node env. Should be ignored at compile-time, done at run-time.
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('node:module');
const module = await import(/** webpackIgnore: true */ 'node:module');
const mod = module.default;
const require = mod.createRequire(import.meta.url);
_sd = require('style-dictionary');
Expand Down

0 comments on commit 77b4f04

Please sign in to comment.