node.js - Deploy MEAN+Webpack on Azure -


how deploy mean stack+webpac application?

  • i have mean stack + webpac application , nodejs server provides rest api
  • i run angular application using webpack dev server
  • after building webpack application,i have build.js file.

how reference build file nodejs application? normally,with requirejs, use html script tag, way

<script src="build.js" />  

i understand not webpac way,

generally speaking, can leverage custom deployment script install nodejs modules , run custom scripts during azure deployment task, build webpack application on azure web apps.

please try following steps:

  1. create file .deployment , deploy.cmd azure-cli command azure site deploymentscript --node --sitepath nodejs
  2. run npm command npm install --save webapck install webpack local application's directory.
  3. define custom npm script in package.json file run webpack command , let deployment task call later: "scripts": { "webpack":"node_modules/.bin/webpack" },
  4. modify deply.cmd file, add process run npm script defined. in original file, can find similar script install node.js modules: :: 3. install npm packages if exist "%deployment_target%\package.json" ( pushd "%deployment_target%" call :executecmd !npm_cmd! install --production if !errorlevel! neq 0 goto error popd )
    can define custom script under it: :: 4. webpack if exist "%deployment_target%\webpack.config.js" ( pushd "%deployment_target%" call :executecmd !npm_cmd! run webpack if !errorlevel! neq 0 goto error popd )
  5. deploy webpack application azure web app via git.

here test webpack app repository on github, fyi.


Comments