-
-
Save tivac/d5ad2e548a97fac7152ca827b0d07c8b to your computer and use it in GitHub Desktop.
Rollup + Mithril w/ code-splitting
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Rollup code-splitting</title> | |
</head> | |
<body> | |
<script src="node_modules/systemjs/dist/system.js"></script> | |
<script src="node_modules/mithril/mithril.js"></script> | |
<script src="dist/index.js"></script> | |
<script>SystemJS.import("./dist/index.js")</script> | |
</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
/* global m */ | |
m.route(document.body, "/", { | |
"/" : { | |
view : () => m("div", "HOME", | |
m("p", | |
m("a", { href : "/page", oncreate : m.route.link }, "/page") | |
) | |
) | |
}, | |
"/page" : { | |
onmatch : () => { | |
return import("./page.js").then((page) => page.default); | |
} | |
} | |
}); |
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
{ | |
"name": "rollup-splitting", | |
"version": "1.0.0", | |
"main": "index.js", | |
"devDependencies": { | |
"mithril": "^1.1.6", | |
"rollup": "^0.55.0", | |
"rollup-plugin-serve": "^0.4.2", | |
"systemjs": "^0.20.19" | |
} | |
} |
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
/* global m */ | |
export default { | |
view : () => m("div", "/page!") | |
}; |
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
module.exports = { | |
input : [ "./index.js" ], | |
output : { | |
dir : "./dist", | |
format : "system", | |
}, | |
experimentalCodeSplitting: true, | |
experimentalDynamicImport: true, | |
plugins : [ | |
require("rollup-plugin-serve")({ | |
port : 10002, | |
contentBase : "./" | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment