-
Notifications
You must be signed in to change notification settings - Fork 4
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
Remove node_modules from published extension? #91
Comments
@strlns Great Observation , the node modules folder wasn't shipped until we introduced a typescript server plugin to resolve #68 . The plugin is enabled by the extension and is shipped with the node_modules hence it shouldn't be ignored by .vscodeignore. The plugin filters our definition results from the declaration file provided by the starter kits like vite ,next, cra etc Checkout the source code of Styled Components extension. https://github.com/styled-components/vscode-styled-components/blob/main/.vscodeignore Also there is a specific commit by one of the contributors to not ignore One alternative I see is to encourage our users to use the plugin directly inside their tsconfig.json. If there is another alternative to this then I'd be happy to have a PR |
Hi @Viijay-Kr, thank you for your response and indeed I also found I'm not sure if I already understand how VSCode extensions hook into the TS language server without using a workspace TS version. I'll check out some more documentation on this as I don't want to jump to invalid conclusions. Casually observed, this package here still weighs a lot more than the packaged extension at https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components. This just makes me wonder if build dependencies are shipped. The deprecation warning on that other package page confuses me quite a bit, as the link is circular. I'll leave this open until I understand the problem better, thank you for the hints. |
@karlhorky if I understand @Viijay-Kr correctly, the added TS language server plugin is the reason why node_modules is included, see Line 154 in c31f061
The code is already bundled via Webpack and the main file loaded by VSCode is the compiled file Line 62 in c31f061
We'd need a way to reference bundled code in the line of my first link instead of using Node module resolution. Or prune the bundled Currently it seems like everything from Not sure if that was helpful, currently I'm not sure if the other entries there are needed at runtime in VSCode context or if they are already bundled by webpack into the dist bundle. |
@strlns Only the TS plugin is needed inside the node_module. The rest is not needed. So moving the other dependencies to dev depending should minimize the load on node_modules |
Bit of a tradeoff here 🤔 Sorry that I'm spending more time writing messages instead of submitting PRs. Currently have to stay in bed because of an injury and haven't got too much energy. Maybe just add |
yes. VS code expects us to ignore node_modules by default. So it doesn't matter if the other dependencies are moved to dev dependencies since they are dev mode only . The extension is shipped as a production bundle using webpack with this one little caveat of including the plugin. So @strlns I wouldn't stress to much on this one as the extension worked well before the introduction of the |
Hi, I'm not sure if I am completely misunderstanding something here, but it seems like you are including your
node_modules
folder in the published extension, which - AFAIK - should never be necessary.https://code.visualstudio.com/api/working-with-extensions/bundling-extension#run-webpack
Related:
Viijay-Kr/typescript-cleanup-definitions#1 (comment)
#90 (comment)
I'm not sure if or why this is necessary?
I'll look if I can provide a PR for this later.
Originally posted by @strlns in #89 (comment)
The text was updated successfully, but these errors were encountered: