Coder Social home page Coder Social logo

Comments (5)

rezaerami avatar rezaerami commented on August 28, 2024

i had the same issue, make sure if you're using type script and have serverless-plugin-typescript, move middleware plugin before typescript plugin, same for tscpaths

here is my serverless.yml before change

... other configs
plugins:
  - serverless-dotenv-plugin
  - serverless-plugin-typescript
  - serverless-tscpaths
  - serverless-middleware
... other configs

image

after change

... other configs
plugins:
  - serverless-dotenv-plugin
  - serverless-middleware
  - serverless-plugin-typescript
  - serverless-tscpaths
... other configs

image

from serverless-middleware.

juanjoDiaz avatar juanjoDiaz commented on August 28, 2024

Hi,

sorry for the slow response.
The main change introduced in v3.2.0 was to ad the file extension to all files using .js.
Typescript does not modify imports and this is the recommended way.

Regarding @rezaerami suggestion, the order is important indeed.
If typescript is used before middleware, then everything is compiled by the typescript plugin and then the middlewares are chained together to create the final handler.
If middleware is used before typescript, then a typescript handler is creating importing all the middlewares and then the typescript function transpiles it to javascript.
I always try to put the middleware plugin before any kind of transpilation plugin or any plugin that changes the code

from serverless-middleware.

juanjoDiaz avatar juanjoDiaz commented on August 28, 2024

If you can create a sample project to reproduce the issue, I will fix it :)

from serverless-middleware.

juanjoDiaz avatar juanjoDiaz commented on August 28, 2024

@zoli-kasa, please read #52 as it provides the solution to your problem.

The issue is related to ts-loader & webpack config.

from serverless-middleware.

zoli-kasa avatar zoli-kasa commented on August 28, 2024

thanks @juanjoDiaz, it worked!

it'd be nice if you could add this to breaking changes or the changelog.

from serverless-middleware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.