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:
- create file
.deployment
,deploy.cmd
azure-cli
commandazure site deploymentscript --node --sitepath nodejs
- run npm command
npm install --save webapck
installwebpack
local application's directory. - define custom npm script in
package.json
file runwebpack
command , let deployment task call later:"scripts": { "webpack":"node_modules/.bin/webpack" },
- 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 )
- deploy webpack application azure web app via git.
here test webpack app repository on github, fyi.
Comments
Post a Comment