After bundling my aurelia app I get a: No PLATFORM.Loader error

前提是你 提交于 2019-12-10 17:14:44

问题


After bundling a simple aurelia application with jspm bundle-sfx I get the following error:

No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app.

An example application: https://github.com/Baudin999/jspm-bundling-test

You can use: npm run setup:dev in a non windows env to switch back to the dev settings (which is just a comment/uncomment in the ./src/client/index.html) and you can use npm run setup:prod to switch back to the production environment, bundling will automatically be triggered. all other scripts can be found in the package.json.

I can't link to other questions because I haven't found any questions which relate to this problem. I "think" (which means absolutely nothing) that this might be related to the fact that aurelia needs a full loader even when bundling with bundle-sfx but I haven't found any ways to solve the error.


EDIT (25/01/2017 17:16): I've found out that the error is because I import the aurelia-bootstrapper. As soon as I add: import * as bootstrapper from 'aurelia-bootstrapper'; I get the error



回答1:


Please add the code how do you bootstrap your aurelia app.
There is nothing actually to import from bootstrapper apart from bootstrap function. Which you would use in case of custom manual bootstrapping.

like in

import { bootstrap } from 'aurelia-bootstrapper'
const configure: (au: Aurelia) => {} = async function (au: Aurelia) {


    au.use
        .standardConfiguration();

    await au.start()
    au.setRoot() // or au.enchance()
})

bootstrap(configure)

in a happy path scenario with jspm - you System.import('aurelia-bootstrapper') and it takes over finding the root node of your app and the script to configure Aurelia (main by default)

Have a look at Bootstrapping Aurelia in the docs

Oh.. and bundle-sfx is not supported there are other means to bundle aurelia apps using jspm



来源:https://stackoverflow.com/questions/41815624/after-bundling-my-aurelia-app-i-get-a-no-platform-loader-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!