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

Unwebpack'd node-modules #169

Open
reconbot opened this issue Jan 20, 2017 · 3 comments
Open

Unwebpack'd node-modules #169

reconbot opened this issue Jan 20, 2017 · 3 comments

Comments

@reconbot
Copy link
Contributor

@tsiege and I are tyring to get webpack to play nice with a module (sgvo) that uses fs.readFileSync and other bad module practices. This doesn't play well with webpack. The best way to include this modules to just mark it an external and just upload it with the index.js.

How can we do that? I'd like to mark a function in such a way that shep zips node-modules with the function.

@reconbot
Copy link
Contributor Author

With shep 3x this can be accomplished with a custom buildCommand. We could copy or install we want into the function's directory and it will get zipped.

@southpolesteve
Copy link
Collaborator

@reconbot I am gonna reopen. This is def possible via a few methods, but I think we should document better.

@tsiege
Copy link
Contributor

tsiege commented Jan 30, 2017

@Steve for documentation purposes, our current work around for shep 3.2.x is the following
webpack.config.js

  externals: {
    'phantom': 'phantom', // module we want in the lambda function
    'aws-sdk': 'aws-sdk',
    'hiredis': 'hiredis'
  },

package.json shep field

  "shep": {
    "region": "us-east-1",
    "accountId": "123",
    "apiId": "abc123",
    "buildCommand": "webpack --bail && PHANTOMJS_PLATFORM=\"linux\" PHANTOMJS_ARCH=\"x64\" npm i [email protected] @bustle/flower --prefix ./dist/function-name"
  },

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