Reputation: 1885
I am .net/php/sql/JavaScript/Angular 1 developer, and I feel a bit lost regarding Angular 2/4 right now.
I am trying to run Angular 4 without Node.JS
1) I downloaded the QuickStart seed found on https://angular.io/guide/setup ( Direct link: https://github.com/angular/quickstart/archive/master.zip )
2) As recommended in How to run AngularJS2 application without Node server I downloaded SystemJS from https://github.com/systemjs/systemjs
3) Here my current html:
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<script src="systemjs/system.js"></script>
<script>
SystemJS.import('test.js')
</script>
</head>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>
After line , I get
SyntaxError: import declarations may only appear at top level of a module
on line 1 of system.js which reads
import { global, isBrowser, isWorker } from './common.js';
How can I get through that error?
Upvotes: 4
Views: 3910
Reputation: 51
Try to create an app with angular-cli https://github.com/angular/angular-cli
ng new myApp
And then, build to static html
ng build --prod
You only need node in your development environment. With ng build your code is bundled and ready for any shared hosting
Upvotes: 3