diff --git a/.dojorc b/.dojorc index d2b47a5..d1fec7d 100644 --- a/.dojorc +++ b/.dojorc @@ -1,33 +1,34 @@ { "extends": "./src/parade.json", "build-app": { + "singleBundle": true, "externals": { "outputPath": ".", "dependencies": [ - { - "from": "node_modules/intern/browser/intern.js", - "to": "browser/intern.js" - }, - { - "from": "node_modules/intern/browser/config.js", - "to": "browser/config.js" - }, - { - "from": "node_modules/intern/loaders/default.js", - "to": "intern/loaders/default.js" - }, - { - "from": "node_modules/intern/loaders/default.js", - "to": "loaders/default.js" - }, - { - "from": "node_modules/intern/index.html", - "to": "intern/index.html" - }, - { - "from": "intern", - "to": "intern" - } + { + "from": "node_modules/intern/browser/intern.js", + "to": "intern/browser/intern.js" + }, + { + "from": "node_modules/intern/browser/config.js", + "to": "intern/browser/config.js" + }, + { + "from": "node_modules/intern/loaders/default.js", + "to": "intern/loaders/default.js" + }, + { + "from": "node_modules/intern/loaders/default.js", + "to": "loaders/default.js" + }, + { + "from": "node_modules/intern/index.html", + "to": "intern/index.html" + }, + { + "from": "intern", + "to": "intern" + } ] } }, diff --git a/src/Test.tsx b/src/Test.tsx index c2c3ac2..ea5ea74 100644 --- a/src/Test.tsx +++ b/src/Test.tsx @@ -1,19 +1,31 @@ import { create, tsx } from '@dojo/framework/core/vdom'; +import { createICacheMiddleware } from '@dojo/framework/core/middleware/icache'; -const factory = create().properties<{ widgetName: string }>(); +interface TestIcache { + mainUrl?: string; +} +const icache = createICacheMiddleware(); +const factory = create({ icache }).properties<{ widgetName: string }>(); -export default factory(function Test({ properties }) { +export default factory(function Test({ properties, middleware: { icache } }) { const { widgetName } = properties(); + const fetchPromise = import('@dojo/framework/shim/fetch'); + const mainUrl = icache.getOrSet('mainUrl', () => fetchPromise.then(({ default: fetch }) => fetch('manifest.json') + .then(result => result && result.ok && result.json()) + .then(json => json && json['main.js']) + .catch())); return (

Tests

-