问题描述
用jspm bundle-sfx
捆绑一个简单的aurelia应用程序后,出现以下错误:
No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app.
示例应用程序: https://github.com/Baudin999/jspm-bundling-test
您可以在非Windows环境中使用:npm run setup:dev
切换回开发设置(这只是./src/client/index.html中的注释/取消注释),并且可以使用npm run setup:prod
来切换回生产环境后,捆绑将自动触发.其他所有脚本都可以在package.json
中找到.
我无法链接到其他问题,因为我没有发现任何与此问题相关的问题.我认为"(这绝对没什么意思),这可能与aurelia即使与bundle-sfx
捆绑在一起也需要一个完整的加载程序有关,但我还没有找到解决该错误的方法.
编辑(25/01/2017 17:16):我发现错误是因为我导入了aurelia-bootstrapper
.一旦添加:import * as bootstrapper from 'aurelia-bootstrapper';
我收到错误消息
请添加代码,如何引导您的aurelia应用.
除了引导程序功能之外,实际上没有任何其他东西可以从引导程序中导入.在自定义手动引导的情况下将使用哪种方式.
喜欢
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)
在使用jspm的情况下-您System.import('aurelia-bootstrapper')然后接管查找应用程序的根节点和脚本来配置Aurelia(默认情况下为main)
在文档中查看引导Aurelia >
Oh ..和bundle-sfx
不支持,还有其他方法可以使用jspm捆绑aurelia应用
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
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
这篇关于捆绑我的aurelia应用程序后,我得到:没有PLATFORM.Loader错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!