Closed fwielstra closed 11 months ago
how'd you solve?
bump
so I solved this by running npm i style-dictionary -g
so that it is a global install, not a local install. For some reason if you install style-dictionary
locally only, you can't use it in a script (package.json)
Actually, I think the problem here is that the error message is misleading. If you don't do extend
correctly the entire object won't work and you won't have buildAllPlatforms
available. After rewriting the whole extend usage, it worked correctly without having to do a global install.
if you do npm ls browser-style-dictionary
you may find that browser-style-dictionary is installed as a dependency of @tokens-studio/sd-transforms
. What actually happens is that this browser-patch of style-dictionary replaces the "real" style-dictionary binary file in the node_modules/.bin
folder, so what you are actually running is browser-style-dictionary, even if you also install style-dictionary as a dependency in your project.
This wouldn't be a big problem normally, but there is a regression in this browser-patch that stopped supporting CommonJS style-dictionary config files (module.exports = { ...your SD config... }
), so then you get this error.
I have fixed @tokens-studio/sd-transforms
this week to no longer rely on this broken browser-patch, so if you delete your node_modules and install the latest (0.11.8
as of writing this), this issue should be fixed.
Either way, the issue is related to @tokens-studio/sd-transforms
and browser-style-dictionary
, see https://github.com/tokens-studio/sd-transforms/issues/197. Therefore, closing this one
I'm trying to get style dictionary to work, following the instructions, but when running
build
or trying to redo the initial setup into my project I'm getting the following error:I can't proceed with anything because of this. Any idea how to resolve this?