Skip to content

Commit

Permalink
chore: add TODO for removing bad practice
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed Dec 4, 2023
1 parent 01eacf4 commit e3d89fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/registerTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export const transforms = [
export async function registerTransforms(sd: Core, transformOpts?: TransformOptions) {
let _sd = sd;

// TODO: Remove in breaking change, this is a bad idea in general because our local Style-Dictionary
// installation will be preferred by Node resolution algorithm over the user's installed version
// in the scenario that multiple versions are installed (e.g. v3 by user and v4 by sd-transforms)
// e.g. node_modules/@tokens-studio/sd-transforms/node_modules/style-dictionary (sd-transforms local)
// versus node_modules/style-dictionary (user local)
// Force user to always pass the instance directly, to prevent nasty bugs.

// 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) {
Expand Down

0 comments on commit e3d89fe

Please sign in to comment.