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

Unreferenced files are not compiled #188

Open
revbingo opened this issue Nov 13, 2019 · 2 comments
Open

Unreferenced files are not compiled #188

revbingo opened this issue Nov 13, 2019 · 2 comments

Comments

@revbingo
Copy link

I'm using ts-lambda-api as a framework for my application, which allows me to declare controllers using decorators that are discovered at runtime, rather than statically declared.

It seems like the typescript plugin only compiles files that can be resolved at compile time from the function entry points, which means the controllers are not compiled.

My workaround at the moment is to have dummy imports in my main class to import those controller classes so they can be found. Is there a better way to control this behaviour?

@michal-simon
Copy link

michal-simon commented Sep 12, 2021

We are using Node Dependency Injection library and experiencing the same issue due to its dynamic imports. Are there any plans to fix this, please?
Our current workaround relies on statically importing the services again in our entry point which is a little hard to maintain.

// ToDo: https://github.com/serverless/serverless-plugin-typescript/issues/188
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import Configurator from './components/Configurator';
...

Does anybody have at least a better workaround, please?

@tamlyn
Copy link

tamlyn commented Jul 13, 2022

It's not ideal but you can use the Package configuration to specify globs of files to include in the package.

package:
  patterns:
    - '!node_modules/**'
    - 'node_modules/node-fetch/**'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants