-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
c3b0863
commit bf70097
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SystemJS nodejs example | ||
|
||
This example shows SystemJS running in the browser. | ||
|
||
## Running locally | ||
|
||
``` | ||
cd nodejs-loader | ||
npm install | ||
npm start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
System.register([], (_export) => ({ | ||
execute() { | ||
_export('default', "Antarctica is the southern continent"); | ||
} | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>SystemJS NodeJS extra</title> | ||
</head> | ||
<body> | ||
<h1>NodeJS extra</h1> | ||
<p> | ||
This project does not run in the browser, but in NodeJS. To run the project, clone this repository, run npm install, and run npm start. See README.md in the <a href="https://github.com/systemjs/systemjs-examples/tree/master/nodejs-loader/">github repository</a> for more details. | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const url = require('url'); | ||
const { System, applyImportMap, setBaseUrl } = require('systemjs'); | ||
|
||
// Setting base URL is optional - the default is to use process.cwd() | ||
// so the code here is redundant | ||
const basePath = url.pathToFileURL(process.cwd()).href; | ||
setBaseUrl(System, basePath); | ||
|
||
applyImportMap(System, { | ||
imports: { | ||
"antarctica": "./antarctica.js" | ||
} | ||
}); | ||
|
||
System.import('antarctica').then(ns => { | ||
console.log('antarctica module', ns); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "nodejs-loader", | ||
"version": "1.0.0", | ||
"description": "This example shows SystemJS running in the browser.", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"systemjs": "latest" | ||
} | ||
} |