-
Notifications
You must be signed in to change notification settings - Fork 43
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
Typescript appears in the generated package.json #524
Comments
Hey there. So as you might guess, typescript is not added to the production dependency list for no reason :) The essence is that ST ignores dev dependencies by default (though that is configurable). This because the dependency graph gets unwieldy real quick. Changing this would have performance implications (ST is already slow, and adding dozens to hundreds of libraries more would be even worse). Also when you disregard dependency versions and only use the newest version of each dependency (like ST does) the graph is also frequently circular, which causes issues since those circles must be broken in somewhat arbitrary ways. I'm sure there are improvements we can do here, but first I'm wondering if this is actually a problem? |
One problem that I've personally encountered is the size of a final artifact being significantly increased. But I think that adding a new dependency that's actually not needed is a bad idea in general, regardless whether it causes any immediate problems. |
Maybe chase down why all of typescript ends up your js bundle? There must be a reference to it somehow, it's not like all |
I'm not sure I understood your comment correctly, but I have built a custom version of this plugin (with the changes from PR #525 applied), and there was no more Typescript in the dependencies section of my package.json. Clearly it was coming from the plugin and nothing else. |
I have a project which uses the ScalablyTyped plugin together with sbt-scalajs-bundler. I have noticed that
"typescript": "4.3"
appears in the dependencies section of the generated package.json, even though none of mynpmDependencies
depend on Typescript (however, I have some Typescript typings in mynpmDevDependencies
).I think this behaviour is caused by these lines:
Converter/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ScalaJsBundlerHack.scala
Lines 22 to 26 in 7a02819
From my understanding (admittedly very limited) of the Javascript ecosystem, this is almost certainly wrong. Since the output of the Scala.js compiler is pure Javascript, it doesn't depend on Typescript unless it has other dependencies that need it.
If the ScalablyTyped plugin requires Typescript to function, I think it should be appended to
npmDevDependencies
instead.The text was updated successfully, but these errors were encountered: