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

chore: add webpack ignore statement to dynamic import #204

Merged
merged 1 commit into from
Oct 6, 2023
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
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
Loading