1
0
mirror of https://github.com/tomasvarg/systemjs-es2015-minimal.git synced 2026-03-01 00:18:49 +00:00

Initial commit - the working setup

This commit is contained in:
Tomas Varga 2018-01-30 17:25:59 +01:00
commit 1a0fc7ab2a
9 changed files with 110 additions and 0 deletions

5
.babelrc Normal file
View File

@ -0,0 +1,5 @@
{
"presets": [
"env"
]
}

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

12
README.md Normal file
View File

@ -0,0 +1,12 @@
# SystemJS minimal ES2015 setup
A minimal SystemJS module loader setup with ES2015 support.
## Usage
Just install dependencies & point a webserver to (or run it in) the project's root.
```
npm install
http-server
```

20
index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>SystemJS es2015 Sample</title>
</head>
<body>
<div id="whatever-app"></div>
<!--
<script src="https://raw.githack.com/zloirock/core-js/v2.5.1/client/core.min.js"></script>
<script src="https://raw.githack.com/zloirock/core-js/v2.5.1/client/shim.min.js"></script>
-->
<script src="node_modules/promise-polyfill/promise.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="system.config.js"></script>
<script>
System.import('index.js');
</script>
</body>
</html>

7
index.js Normal file
View File

@ -0,0 +1,7 @@
import { showMessage } from './src/utils';
console.log('Hello from es5!');
setTimeout(() => {
console.log('Hello from es6!');
showMessage('Hello from es6!', '#whatever-app');
}, 0);

23
package-lock.json generated Normal file
View File

@ -0,0 +1,23 @@
{
"name": "systemjs-es2015-sample",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"promise-polyfill": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.0.2.tgz",
"integrity": "sha1-2chtPcTcLfkBboiUbe/Wm0m0EWI="
},
"systemjs": {
"version": "0.20.18",
"resolved": "https://registry.npmjs.org/systemjs/-/systemjs-0.20.18.tgz",
"integrity": "sha512-i/v5cx79piwoKk+dUMgZ8LNMOc2ieILqCO7XPrulfDzG0dp9+9d3errwBkyb0rUshdmR97noKj9tixNm7itbdA=="
},
"systemjs-plugin-babel": {
"version": "0.0.25",
"resolved": "https://registry.npmjs.org/systemjs-plugin-babel/-/systemjs-plugin-babel-0.0.25.tgz",
"integrity": "sha512-RMKSizWWlw4+IpDB385ugxn7Owd9W+HEtjYDQ6yO1FpsnER/vk6FbXRweUF+mvRi6EHgk8vDdUdtui7ReDwX3w=="
}
}
}

23
package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "systemjs-es2015-minimal",
"version": "0.0.1",
"description": "A minimal SystemJS module loader setup with ES2015 support.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"systemjs",
"babel",
"es2015",
"starter",
"sample"
],
"author": "Tomas Varga <tomas.varga.cz@gmail.com>",
"license": "ISC",
"dependencies": {
"promise-polyfill": "^6.0.2",
"systemjs": "^0.20.18",
"systemjs-plugin-babel": "0.0.25"
}
}

4
src/utils.js Normal file
View File

@ -0,0 +1,4 @@
export const showMessage = (message, elemSelector) => {
var elem = document.querySelector(elemSelector);
if (elem) elem.innerHTML = message;
};

15
system.config.js Normal file
View File

@ -0,0 +1,15 @@
/* global System */
System.config({
packages: {
'.': { defaultExtension: 'js' }
},
meta: {
'.': { format: 'esm' },
},
map: {
'plugin-babel': 'node_modules/systemjs-plugin-babel/plugin-babel.js',
'systemjs-babel-build': 'node_modules/systemjs-plugin-babel/systemjs-babel-browser.js'
},
transpiler: 'plugin-babel'
});