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

[QUESTION] Deployment issue #58

Open
bolicd opened this issue Jun 12, 2017 · 3 comments
Open

[QUESTION] Deployment issue #58

bolicd opened this issue Jun 12, 2017 · 3 comments
Labels

Comments

@bolicd
Copy link
Contributor

bolicd commented Jun 12, 2017

Hi,

We are currently trying to deploy this boilerplate on Windows Azure AppService. Thats basically NodeJs server wrapped into iisnode module(in essence it should function the same as nodejs/express server).

When using steps for deployment, locally it works fine. However, when deployed on Azure app service we are getting the following error:
(function (exports, require, module, __filename, __dirname) { import Express from 'express' ^^^^^^ SyntaxError: Unexpected token import at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10)

For Azure deployment all that needs to be done is to configure web.config file which points to server.js file which should not be the cause of this issue. It seems that this is something to do with babel transpiler missing on deployment machine.

Any idea on how to solve this issue?

Thank you

@mz026 mz026 added the question label Jun 13, 2017
@mz026
Copy link
Owner

mz026 commented Jun 13, 2017

From the error message, it seems NodeJS tried to run ES6 without babel.

To run server side code without pre-built with babel (like in development), we should point the entry file to server/index.js, which require-s babel/register, instead of server/server.js.

Or, there's a task inside gulpfile building server side code with Babel. By running gulp build, it would build server side code under dist/server-build. After that we can point the entry file to the built one.

@bolicd
Copy link
Contributor Author

bolicd commented Jun 13, 2017

Thanks that was one of the problems 👍

Theres some more issues when deploying on Azure, managed to solve them all now im improving procedure a bit. I'll write steps needed in case someone else tries to do the same.

Thanks

@bolicd
Copy link
Contributor Author

bolicd commented May 4, 2018

For deployment on Azure Web App:

  • Add new filed .deployment into the project. This file basically tells Azure Web App Kudu which script to run after copying files is done.
  • the script is in file deploy.cmd -> here you probably want to do yarn install after
  • set value of API_BASE_URL to the desired value in Web App Settings! This value will be used in the app

More info about this can be found:
https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants