Serverless-webpack: serverless-plugin-typescript, serverless-plugin-chrome, serverless-webpack, serverless-offline compatibility

Created on 20 Jan 2019  路  6Comments  路  Source: serverless-heaven/serverless-webpack

This is a Bug Report

Sorry, unsure which repo this issue would belong to, given the number of plugins in use.

Description

Trying to use the combination of plugins:

  • serverless-plugin-typescript
  • serverless-plugin-chrome
  • serverless-webpack
  • serverless-offline

Typescript needs to come before chrome.
Webpack needs to come after chrome.

However, webpack needs to come before Typescript otherwise webpack config isn't copied during serverless offline

The webpack plugin could not find the configuration file at: C:\Users\XXX\Desktop\project-name\.build\webpack.config.js

For bug reports:

  • What went wrong?
    webpack config is not moved into .build when running serverless-offline

For feature proposals:

  • What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
  • If there is additional config how would it look
const path = require('path');
const slsw = require('serverless-webpack');
const webpack = require('webpack');

module.exports = {
  entry: slsw.lib.entries,
  target: 'node',
  resolve: {
    extensions: ['.json', '.js', '.jsx', '.ts', '.tsx'],
    alias: {
      puppeteer: require.resolve('puppeteer/node6/lib/Puppeteer'),
      symlinks: 'true',
    },
  },
  node: {
    __dirname: true,
  },
  output: {
    libraryTarget: 'commonjs',
    path: path.join(__dirname, '.webpack'),
    filename: '[name].js',
  },
  externals: ['aws-sdk', 'puppeteer/node6/lib/Puppeteer'],
  module: {
    rules: [
      {
        test: /\.ts(x?)$/,
        loader: 'ts-loader',
      },
    ],
  },
  plugins: [
    new webpack.optimize.LimitChunkCountPlugin({
      maxChunks: 1,
    }),
  ],
};

Additional Data

  • Serverless-Webpack Version you're using:
    "serverless-offline": "^4.1.4",
    "serverless-webpack": "^5.2.0",
    "serverless-plugin-typescript": "^1.1.5",
    "serverless-plugin-chrome": "^1.0.0-55",

  • Webpack version you're using:
    "webpack": "^4.29.0"

  • Serverless Framework Version you're using:
    "serverless": "^1.36.1",

  • Operating System:
    OS: win32
    Node Version: 8.10.0
    Serverless Version: 1.36.1

Most helpful comment

No, Even by changing orders, some other problem appeared. I am having compatibility issues with all these working together with aws lambda and puppeteer.

All 6 comments

Just overflew the problem (and I am not related to serverless-webpack, just a user), but: serverless-plugin-typescript has not seen major modification since quite a time and looks abandoned to me; more importantly, serverless-webpack can compile and bundle your typescript projects all by itself, there is no need for the typescript plugin, AFAICT.

perhaps the problem doesn't sit here.

Webpack plugin was fine with compiling but because I was using offline plugin, I either:

  1. Pointed to look at a build folder
  2. Used typescript so it all happened as part of one step

Will close the issue.

Thank you for trying to help

I am also facing the issue

  • serverless-plugin-chrome
  • serverless-webpack

These two should come in this order only, but my project is in TS, so Injecting Headless chrome to JS files fails.

Error: ENOENT: no such file or directory, link '/.build/src/api/func.js' -> '/.build/src/api/dai0bwfuzyf___func.js'
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:372:22)

@erdahuja Did you solve that? I'm having the same problem where the ts isn't transpiled into js first. Surely it should make more sense to have the serverless-webpack plugin first? Unfortunately it then results in this error "The plugin "serverless-webpack" should appear after the "serverless-plugin-chrome" plugin in the plugin configuration section of serverless.yml."

No, Even by changing orders, some other problem appeared. I am having compatibility issues with all these working together with aws lambda and puppeteer.

@erdahuja Any update on this? I'm facing the very same issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timoangerer picture timoangerer  路  3Comments

deftomat picture deftomat  路  5Comments

rvaidya picture rvaidya  路  4Comments

tommedema picture tommedema  路  4Comments

slushnys picture slushnys  路  5Comments