systemjs

How to globally import Javascript library in Angular2 Typescript project?

白昼怎懂夜的黑 提交于 2019-12-06 09:47:24
I'm trying to figure out how to propertly import an external library in my Angular2 projects. As you can see reading other answers about this matter, there is a bit of confusion about it, and even Angular2 documentation have no info about it. In addition, any search on Google leads to old results related to alpha or beta version of Angular2. I'm trying to import Foundation and jQuery libraries. I need the first to use some Foundation code, and i need the second to make Foundation JS code to work (it uses jQuery) and even to uses it in my Typescript components. As far as i know since i have to

Unexpected token export

孤人 提交于 2019-12-06 06:47:12
问题 As a new Angular rookie, I am trying to upgrade my previously working Angular 2.0.0-beta17 web-app to Angular 2.3.0. Now I have a problem while loading/booting the app. Here's my setup: For solution purposes, I copied all node_modules in the web directory for now. So no files should be missing. (web directory) ├── index.html ├── js │ ├── boot.js │ ├── boot.js.map │ ├── feedback-form.component.js │ ├── feedback-form.component.js.map │ ├── feedback-form.service.js │ ├── feedback-form.service.js

Component rendered as comment in VueJS + JSPM

不想你离开。 提交于 2019-12-06 05:54:12
问题 I tried to build simple app using jspm with vue.js. This is my html file: <html> <head> <script src="bundle.js"></script> <!--script src="jspm_packages/npm/vue@2.1.10/dist/vue.min.js"></script--> </head> <body> <div id="app"> {{ message }} </div> </body> </html> My main.js file: import Vue from "vue" const app = new Vue({ el: '#app', data: { message: 'Hello Vue!' } }); I'm building self-executing bundle like this: jspm bundle-sfx main.js bundle.js When I open browser I can see that node div

404s after updating to systemjs-angular-loader.js

陌路散爱 提交于 2019-12-06 03:40:23
I am updating my Angular project and decided to remove all instances of moduleId: module.id , as the docs have instructed me to here: https://angular.io/docs/ts/latest/guide/change-log.html All mention of moduleId removed. "Component relative paths" cookbook deleted (2017-03-13) We added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration. This plugin dynamically converts "component-relative" paths in templateUrl and styleUrls to "absolute paths" for you. We strongly encourage you to only write component-relative paths. That is the only form of URL

Error importing Typescript-compiled modules with System.js

﹥>﹥吖頭↗ 提交于 2019-12-06 03:18:05
问题 I am recently learning to use system.js to import modules which compiled by Typescript. The modules were previously compiled for require.js, and works fine. However, when merging to system.js, the modules cannot be imported when applying system-production.js . The console says Uncaught (in promise) Error: Module instantiation did not call an anonymous or correctly named System.register. Instantiating https://www.star.com/libs/js/klondike.js Loading ./libs/js/klondike.js at register-loader.js

How to import external NPM module with Typescript declarations using JSPM

一笑奈何 提交于 2019-12-06 02:57:47
'test-module' is external module written in Typescript with index.d.ts definition file. it has properties for tsd/tsc in package.json: "typings": "dist/index.d.ts", "typescript": { "definition": "dist/index.d.ts" } 'test-module' is installed with JSPM in jspm_packages/npm/test-module for dynamic loading using SystemJS 'app' is Typescript application that imports 'test-module' like this: import {Component} from 'test-module'; The problem is that 'test-module' module HAS TO BE in both locations: in node_modules for Typescript compiler (otherwise it does not find 'test-module' and errors it

Typescript Compiler error TS2307: Cannot find module 'jquery'

爷,独闯天下 提交于 2019-12-06 01:31:36
问题 I was following JSPM getting started guide and I want to install jquery package so I execute below command. jspm install jquery But when I try to import it in typescript like below import $ from 'jquery' I'm getting a error from typescript compiler saying error TS2307: Cannot find module 'jquery'. Not only for this library for other libraries I'm getting the same error. 回答1: You need to include type definitions for jquery in the compilation context, you can grab them from https://github.com

Integrate MathJax into SystemJS build

牧云@^-^@ 提交于 2019-12-06 00:38:51
I use SystemJS to build an Angular 2 application and I'd like to start using MathJax in a component. I installed with: npm install --save-dev mathjax npm install --save @types/mathjax MathJax is now installed in /node_modules/mathjax . When my component does import "mathjax" , the file /node_modules/mathjax/MathJax.js is loaded. So far so good. Problem is that this file then tries to load other files using paths relative to the project root instead of the MathJax install directory. For instance, MathJax.js tries to load /extensions/MathMenu.js 404 Not found /extensions/MathZoom.js 404 Not

Can I replace systemJS by webpack with angular2

≯℡__Kan透↙ 提交于 2019-12-06 00:18:47
I understood that systemJS and webpack are doing the same. So I would like to replace systemJS by webpack but when I'm removing the system.js script reference in my html page I get the following error: angular2.js:2 Uncaught ReferenceError: System is not defined Does it means that angular2 is using SystemJS as module loader without the possibility to replace it by another one? Alexander Trakhimenok Yes, you can. There are few examples & tutorials . For example: https://github.com/preboot/angular2-webpack https://github.com/AngularClass/angular2-webpack-starter https://github.com/blacksonic

How to export a TypeScript module for SystemJS?

ぐ巨炮叔叔 提交于 2019-12-05 22:53:21
On my website I want to import a FancyModule using SystemJS , so that I can create instances of classes which this module exports. So what I want to achieve is this (within a ECMAScript 2015-compatible website): SystemJS.import('MyFancyModule').then(function(MyFancyModule) { var myFancyInstance = new MyFancyModule.MyFancyClass('Test'); console.log(myFancyInstance.text); }); Unfortunately, I am getting the following error: TypeError: MyFancyModule.MyFancyClass is not a constructor(…) Here is my TypeScript module: export module MyFancyModule { export class MyFancyClass { public text: string;