Tag: jspm

System.importasynchronous模块加载冲突与脚本标记同步加载

我开始使用primefaces/电子的JSPM来移植我用Marionette构build的网站。 我有我所有的应用程序写的木偶模块,所以我想在启动应用程序之前加载所有JavasSript文件。 <script src="jspm_packages/system.js"></script> <script src="config.js"></script> <script> loadApp = System.import('./scripts/app_definition').then(function(m){ window.App = m['App']; }); </script> <!– inject:js –> ##LOTS INJECTED SCRIPTS THAT NEEDS window.App to be defined## <script src="compiled/modules/video/video_app.js"></script> <!– endinject –> <script type="text/javascript"> loadApp.then(function(){ App.start(); }) </script> 我遇到了System.import()的asynchronous性质问题。 在System.import加载完App代码后,你将如何加载脚本? 对于生产我没有问题,因为我会连接在一个单一的JS模块中的所有文件,并加载该模块使用System.import,但这将是一个噩梦debugging,我宁愿有文件加载单独。 有什么想法吗? 谢谢!

安装jspm到^ 0.16.34没有提供registry属性

我对前端开发相当陌生,正在通过Brian Noyes Aurelia Fundamentals课程进行工作 我已经安装了以下内容; node-v4.4.4×64 Git-2.8.2-64 我也跑了 npm install jspm –save-dev 并有这个结果 当我跑了 npm install =g jspm gulp http-server 我收到消息说以下内容已被弃用。 graceful-fs@3.0.8和lodash@1.0.2 然后当我跑了 jsm init 我有一个错误 package.json文件是 { "jspm": {}, "devDependencies": { "jspm": "^0.16.34" } } 我该如何解决这个错误?

如何正确使用System.import()?

我在我的项目中使用jspm 。 但是我需要服务器端的nodejs文件来执行一些指令。 例如,我需要使用lodash并在https://github.com/systemjs/systemjs中find指南 var System = require('jspm').Loader(); System.import('lodash').then(function (_) { console.log(_); }); 不过,我想在全球范围内使用lodash。 就像 var _ = System.import('lodash'); var myArr = _.map([1, 2, 3], function(n) { return n * 3; }); 它会显示 TypeError:_.map不是Object的函数。 (/ usr / local / lib / node_modules / babel / node_modules / babel)在Module._compile(module.js:435:26)处调用(/Users/joyfeel/javascript/jspm-test/index.js:49:16) (匿名函数)[as .js](/ usr / local / lib […]

riotts(riot-ts)和jspm – 任何人都可以一起工作?

我一直在看这个雄心勃勃的项目https://github.com/nippur72/RiotTS ,已经把骚乱转移到暴乱。 作者已经使用了鲍尔,我试图让它使用jspm工作。 riot-ts不存在于jspm回购列表中,所以我使用jspm install npm:riot-ts导入jspm install npm:riot-ts 的package.json: { "jspm": { "directories": { "baseURL": "public/assets" }, "dependencies": { "riot-ts": "npm:riot-ts@^1.0.14" }, "devDependencies": { "babel": "npm:babel-core@^5.8.24", "babel-runtime": "npm:babel-runtime@^5.8.24", "core-js": "npm:core-js@^1.1.4" } }, "devDependencies": { "elixir-jasmine": "0.0.4", "gulp": "^3.9.1", "jspm": "^0.16.35", "laravel-elixir": "^6.0.0-2", "laravel-elixir-browsersync": "^0.1.5", "ws-laravel-elixir-typescript": "git+https://github.com/we-studio/laravel-elixir-typescript.git" }, "dependencies": { "bootstrap": "^4.0.0-alpha.2" } } SystemJSconfiguration(为简洁起见,省略了一些文件): System.config({ […]

Flux扔分派器不是一个构造函数

我尝试使用jspm与reactjs。 我工作得很好。 但是当我把它与npm的flux包结合起来的时候。 那么它总是抛出Dispatcher不是一个构造函数错误。 我的代码如下 AppDispatcher.js import Flux from 'flux'; export default new Flux.Dispatcher(); StoreBase.js 'use strict'; import {EventEmitter} from 'events'; import AppDispatcher from '../dispatchers/AppDispatcher'; const CHANGE_EVENT = 'change'; export default class BaseStore extends EventEmitter { constructor() { super(); } subscribe(actionSubscribe) { this._dispatchToken = AppDispatcher.register(actionSubscribe()); } get dispatchToken() { return this._dispatchToken; } emitChange() { this.emit(CHANGE_EVENT); […]

如何在Webpack 2.x中debuggingSystemJS ENOENT没有这样的错误错误?

升级到Webpack 2.x后,编译和重新编译(在HMR模式下)出现此错误: (SystemJS) Error: ENOENT: no such file or directory, open … 有没有人find解决办法? 这里是源代码: https://github.com/kriasoft/react-static-boilerplate/tree/webpack2 (见PR #102 )

SystemJS插件可以修改已经传输的文件吗?

当试图让Angular(1.x)与systemjs一起工作时,我意识到目前还没有能力(我知道)将$inject自动插入到angular度组件中,即使当函数的参数是被缩小器弄坏了。 手动创build$inject注释注解是单调乏味的,容易出错,违反了DRY本体 。 有一个称为ng-annotate的成熟的npm模块可以解决这个问题,并且在许多类似的情况下用于捆绑。 正如我一直在探索SystemJS,我看到有一个插件系统,包括翻译源代码的能力,这正是ng-annotate所做的。 但是,从我所看到的,SystemJS只允许您将特定文件扩展名映射到单个加载程序,并且插件的所有示例都将支持新的文件types。 我想要做的是后处理SystemJS的transpilation过程的输出,而不是添加一个新的文件types。 看起来像SystemJS应该能够做到这一点,因为它有一个处理pipe道,但我不能完全弄清楚如何正确的方法。 现在我正在使用Browserify来达到同样的效果,但是我最终得到了一组相当复杂的构build任务,如果可能的话,我想用SystemJS来简化它。 其他能够在SystemJS的加载器pipe道中使用ng-annotate的策略也是值得赞赏的。

使用SystemJS生成工作stream,并通过CDN托pipe外部依赖项

我试图找出一个良好的生产工作stream程,与开发工作stream程很好。 需要从构build中排除1MB的外部库,然后使用CDN分别托pipe它们。 所以我们有这个: <script src="jspm_packages/system.js"></script> <script src="config.js"></script> <script src="build.js"></script> <script> System.import('app/main.js'); </script> 这很好,main.js中的任何内容都被忽略,因为它已经包含在build.js中。 虽然我猜这意味着什么时候该回到开发热门的时候,我们必须先删除build.js? 所以现在我想分开生产的外部依赖关系: builder.buildStatic('app/main.js', 'build.js', { externals: ['jquery'], globalName: 'App', globalDeps: { 'jquery': 'jQuery' } }); 当我们这样做时,我们需要添加一行: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2 jquery.min.js"></script> <script src="jspm_packages/system.js"></script> <script src="config.js"></script> <script src="build.js"></script> <script> System.import('app/main.js'); </script> 这意味着,当我们切换回开发版本时,jQuery将被双重捆绑到main.js中? 然后是SystemJS的片段: System.config({ bundles: { 'build/core': ['jquery'] } }); System.import('app/main.js'); 不知道如何使用这个,因为现在我们不会使用CDN来托pipejQuery。 所以对我来说,这种感觉就像一个捕捉22. JSPM是伟大的,因为它给你的包pipe理,但要在生产中使用的包,你希望他们在外面。 所以如果我们不得不在页面中包含脚本标签,那么这不就是JSPM的目的呢? […]