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

Correct fix to get a working demo setup #3

Merged
merged 3 commits into from
Aug 16, 2017
Merged

Correct fix to get a working demo setup #3

merged 3 commits into from
Aug 16, 2017

Conversation

ringods
Copy link
Contributor

@ringods ringods commented Aug 16, 2017

Correct fix to get a working demo setup with latest dependency versions. The correct fix, as suggested by @HyperBrain was to remove the location setting from the serverless-offline plugin.

Also updated the dependencies to the latest versions. Verified correct functioning after bumping each of the dependencies.

@HyperBrain
Copy link
Contributor

It seems that I should add the --location removal/usage instructions to the serverless-webpack V3 README 😄 .

@ktonon
Copy link
Owner

ktonon commented Aug 16, 2017

I removed node_modules, .webpack, and elm-stuff, then ran npm install and npm start. From the command line it all looks ok, but when I try to visit http://localhost:3000, I get the following error:

{
"errorMessage": "Error while loading hello",
"errorType": "SyntaxError",
"stackTrace": [
"/Users/ktonon/repos/elm-serverless-demo/src/Hello/API.elm:1",
"(function (exports, require, module, __filename, __dirname) { port module Hello.API exposing (main)",
"^^^^^^",
"SyntaxError: Unexpected identifier",
"at Object.exports.runInThisContext (vm.js:76:16)",
"at Module._compile (module.js:542:28)",

This is what I have

> $ npm ls --depth 0
elm-serverless-demo@1.0.0
├── cross-env@3.2.4
├── elm@0.18.0
├── elm-serverless@4.0.0
├── elm-webpack-loader@4.3.1
├── eslint@3.19.0
├── eslint-config-es2015@1.1.0
├── rc@1.2.1
├── serverless@1.19.0
├── serverless-offline@3.15.3
├── serverless-webpack@3.0.0-rc.1
├── shebang-loader@0.0.1
├── strip-debug-loader@1.0.0
└── webpack@3.5.4

@ringods
Copy link
Contributor Author

ringods commented Aug 16, 2017

@ktonon you are right. I still had a wrong serverless-webpack 2.2.0. With 3.0.0-rc1, I have the same error.

@HyperBrain
Copy link
Contributor

HyperBrain commented Aug 16, 2017

If it works stable with 2.2.0 with these settings, I'd propose that you use the official 2.2.0 for now. I'll check V3 to see why it breaks there. Eventually we should create a bug for that in serverless-webpack.
A possible fix would be integrated in rc.2 then.

@HyperBrain
Copy link
Contributor

@ktonon @ringods I think I already know the reason of the issue. It's the file glob lookup of the handlers on execution. It mistakenly choses api.elm instead of api.js. This issue is definitely a serverless-webpack V3 issue where the lookup algorithm changed. I will schedule a fix for rc.2.
Please use 2.2.0 for now. I'll let you know when a fixed version is available.

@ringods
Copy link
Contributor Author

ringods commented Aug 16, 2017

@ktonon I reverted serverless-webpack to 2.2.0 for the time being. This setup works AFAICS, so can you merge this?

@ktonon
Copy link
Owner

ktonon commented Aug 16, 2017

Thanks

@ktonon ktonon merged commit 1163dfa into ktonon:master Aug 16, 2017
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

Successfully merging this pull request may close these issues.

3 participants