completecoding / serverless-auto-swagger

80 stars 48 forks source link

Webpack Compilation Failed #116

Open simonphughes opened 1 year ago

simonphughes commented 1 year ago

I have a typescript v3 project, and i have tried following the instructions by adding in the add-in.

If I run the sls generate-swagger command then it creates me a swagger directory, but if i try and deploy normally then i get the following webpack error: in ./swagger/swagger-json.js 3:16-36 Module not found: Error: Can't resolve './swagger' in 'C:\myfolderstructure\swagger' resolve './swagger' in 'C:\myfolderstructure\swagger' using description file: C:\myfolderstructure\package.json (relative path: ./swagger) using description file: C:\myfolderstructure\package.json (relative path: ./swagger/swagger) no extension C:\myfolderstructure\swagger\swagger doesn't exist .mjs C:\myfolderstructure\swagger\swagger.mjs doesn't exist .json C:\myfolderstructure\swagger\swagger.json doesn't exist .ts C:\myfolderstructure\swagger\swagger.ts doesn't exist js C:\myfolderstructure\swagger\swaggerjs doesn't exist as directory C:\myfolderstructure\swagger\swagger doesn't exist

Any help much appreciated.

lmanerich commented 1 year ago

Same problem. Removing serverless-webpack from plugins list solves the issue.

lmanerich commented 1 year ago

Hey @simonphughes I manage to solve the issue by adding *.js to the webpack configuration:

module.exports = {
    resolve: {
        extensions: ['.mjs', '.json', '.ts', '.js'],
        symlinks: false,
        cacheWithContext: false
    },
...