Comments (4)
@jkhask
The fact is that now v2 was released the 8 nov 2018 and the repository was initially setup to work with now v1.
The build workflow with now v2 is great but there is no builder optimized for angular universal application:
- Static Builder: works with angular as single page application ;
- Node.js Server Builder: works with node server application.
I tried to combine the both builders but I don't succeed to make them works as expected.
I think we need to write a builder optimized for universal application.
now v1 has more flexibility so we can still use it to deploy our angular universal application
You can configure the version 1 in the now.json
and don't forget to create .nowignore
file to exclude dist
and node_modules
folders.
---------------------------------- .nowignore ----------------------------------
new file mode 100644
index 0000000..de4d1f0
@@ -0,0 +1,2 @@
+dist
+node_modules
----------------------------------- now.json -----------------------------------
new file mode 100644
index 0000000..87a0dd6
@@ -0,0 +1,4 @@
+{
+ "version": 1,
+ "name": "ng-universal"
+}
Finally run now deploy
and that works well!
from angular-universal.
seems we cannot use now 1 anymore
I've used your now.json and .nowignore files but still get the error:
Error! You tried to create a Now 1.0 deployment. Please use Now 2.0 instead: https://zeit.co/upgrade
from angular-universal.
I tried again to deploy for now v2 with Node.js Server Builder: I don't succeed too.
Below what I tried (patch at end of this post):
- remove scripts
now-build
adnnow-start
frompackage.json
; - create
.nowignore
with contentnode_modules
; - update
now.json
with version 2 and builders{ "src": "./dist/app/server/main.js", "use": "@now/node-server" }
; - run
now deploy
and open url deployment.
I just see a file explorer which has file ./dist/app/server/main.js
only.
May I don't understand how to deploy a node server (with others static assets) with now v2?
If someone can help do not hesitate. Because the only I see to do what we need to deploy angular universal application with now v2 is to write a custom builder.
--
diff --git a/.nowignore b/.nowignore
index de4d1f0..3c3629e 100644
--- a/.nowignore
+++ b/.nowignore
@@ -1,2 +1 @@
-dist
node_modules
diff --git a/now.json b/now.json
index 87a0dd6..25b6e79 100644
--- a/now.json
+++ b/now.json
@@ -1,4 +1,10 @@
{
- "version": 1,
- "name": "ng-universal"
+ "version": 2,
+ "name": "ng-universal",
+ "builds": [
+ {
+ "src": "./dist/app/server/main.js",
+ "use": "@now/node-server"
+ }
+ ]
}
diff --git a/package.json b/package.json
index 41ab2e7..0a4012a 100644
--- a/package.json
+++ b/package.json
@@ -11,9 +11,7 @@
"dev:spa": "ng serve --hmr",
"test": "ng test",
"lint": "ng lint",
- "e2e": "ng e2e",
- "now-build": "ng run angular:udk:production",
- "now-start": "node ./dist/app/server/main.js"
+ "e2e": "ng e2e"
},
"private": true,
"dependencies": {
from angular-universal.
Has anyone gotten this to work with current Vercel? I tried something like this, but it does not work:
{
"version": 2,
"public": true,
"name": "test-universal",
"builds": [
{ "src": "package.json", "use": "@vercel/static-build" },
{ "src": "./dist/test/server/main.js", "use": "@vercel/node" }
],
"routes": [{ "src": "/(.*)", "dest": "./dist/test/server/main.js" }]
}
J
from angular-universal.
Related Issues (20)
- window is not defined AND localStorage is not defined errors in terminal HOT 10
- How to keep state across module reloads HOT 2
- Could not find the implementation for builder udk:udk-builder HOT 4
- typo in udk.container.js
- npm start has 'SyntaxError: Unexpected string' on main.server.ts HOT 4
- HMR not working correctly - entire app reloads on change HOT 4
- Does HMR only replace module HOT 4
- changes are not reflected in server build HOT 3
- TransferStateModule not being used HOT 3
- What is the difference between this repo and angular/universal-starter ? HOT 2
- error with current build HOT 5
- Lazy loading modules does not work with new syntax HOT 9
- Does this project offer HMR and SSR simultaneously? HOT 4
- Error with latest master HOT 3
- Support for Angular 11 HOT 6
- assets folder is not copied to dist/app/browser HOT 2
- lazy load module not working in server side HOT 4
- What happened with the commit history? HOT 3
- Can't bind to 'errorImage' since it isn't a known property of 'img'. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-universal.