-
Notifications
You must be signed in to change notification settings - Fork 417
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
Help: ES6 import gives "module initialization error: TypeError" #486
Comments
Please refer to the webpack documentation: tl;dr - Add this to your webpack.config.js: resolve: {
extensions: ['.js']
} |
Thanks for the tip @Zn4rK, I've been on that page a few times during trying to get this to work. Unfortunately it didn't do any difference. I still get the same error. I've tried using setups I've found in example repos as well without any luck. Any other tips on what might be wrong? |
I created a public repository with my setup and that gives me the error when I deploy it. Should I change my |
Change: module.exports.handle = [code] to: export const handle = [code] If you really want to use module.exports instead, you need to define it first.
You should also put the package |
I would also recommend the package |
Finally it works, thank you @Zn4rK ! FYI, putting
However it works when I keep it in as a dependency, so I'll just keep it in there :) And thanks for the tip about |
FYI |
This is a Bug Report
Bug report or me doing something wrong.
Description
I get the error
module initialization error: TypeError
when I use ES6 imports. Everything builds and deploys but I get the error when I trigger the lambda with the import statement. I've been trying to solve this by using different configurations and solutions that I've found around the web but can't get it to work.My lambda function:
My helper class with the export:
serverless.yml
.babelrc
webpack.config.js
package.json
Similar or dependent issue(s):
Additional Data
The text was updated successfully, but these errors were encountered: