Reputation: 857
How do I deploy a MEAN STACK+WEBPAC application?
How do I reference the build file from the nodejs application? Normally,with requirejs, I would use the html script tag, this way
<script src="build.js" />
I understand this is not the webpac way,
Upvotes: 2
Views: 3765
Reputation: 13918
Generally speaking, we can leverage Custom Deployment Script to install the nodejs modules and run custom scripts during the Azure Deployment task, to build your webpack application on Azure Web Apps.
Please try the following steps:
.deployment
and deploy.cmd
by azure-cli
command azure site deploymentscript --node --sitePath nodejs
npm install --save webapck
to install webpack
into your local application's directory.package.json
file to run webpack
command and let the deployment task call later:
"scripts": {
"webpack":"node_modules/.bin/webpack"
},
deply.cmd
file, add a process to run the npm script we defined. In the original file, you can find the similar script to install the 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
)
:: 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
)
Here is my test webpack app repository on Github, FYI.
Upvotes: 9