Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:43
    StuffOfInterest commented #2389
  • 09:35
    arthurdenner commented #2389
  • May 12 20:17
    github-actions[bot] commented #2396
  • May 12 20:17
    nilzona edited #2396
  • May 12 20:16
    nilzona opened #2396
  • May 12 20:06
    nilzona opened #2395
  • May 04 08:46
    SunHuawei edited #2394
  • May 04 08:45
    SunHuawei edited #2394
  • May 04 08:45
    SunHuawei edited #2394
  • May 04 08:45
    SunHuawei edited #2394
  • May 04 08:44
    SunHuawei edited #2394
  • May 04 08:43
    SunHuawei edited #2394
  • May 04 08:41
    SunHuawei opened #2394
  • May 02 20:11
    markwhitfeld commented #2393
  • May 02 20:11
    markwhitfeld commented #2393
  • May 02 19:42
    markwhitfeld commented #2393
  • May 02 19:42
    markwhitfeld converted_to_draft #2393
  • May 02 13:58
    markwhitfeld edited #2393
  • Apr 30 12:44
    markwhitfeld edited #2393
  • Apr 30 12:43
    markwhitfeld commented #2393
Akanksha Singh
@Flamingo09
Hello everyone. I need help. I'm using systemJS with import map inside my react application to load certain external modules (micro front end modules) . I have configured cors in my webpack-dev-server. Still it's throwing cors access not allowed error. Any idea, on how to fix it?
@hiaparna I'm using same single-spa for microfrint end, but getting cors error when importing modules using systemJS. Can you please help me, on how you did it.
Jari Germeraad
@jari_germeraad_gitlab

Hey everyone!

We're currently using SystemJS' Import Maps with single-spa and we were wondering whether we can add a header to the requests done by SystemJS (if I'm not mistaken?)!
It would be a custom header.

Any thoughts? Thanks!

Frank Lemanschik
@frank-dspeed
it is possible you can add a modifyed loader
or you use serviceworkers
both are good methods
ehm sorry
serviceworkers :)
thats the right term
Guy Bedford
@guybedford
@jari_germeraad_gitlab custom headers aren't supported for script tags in browsers, but you could do this by using a fetch loader and then cutomizing the fetch request. You can use the module types extra and then set the shouldFetch hook to always return true in https://github.com/systemjs/systemjs/blob/master/docs/hooks.md#shouldfetchurl---boolean. Then hook the fetch call as well itself to add the extra headers you need.
Michiel Vermandel
@resolvethis
Hi, I want to use SystemJS 6 to build a plugin system in Angular. Almost any example uses SystemJS 0.2x. Is it possible to achieve the same as describes in this SO question with SystemJS6? https://stackoverflow.com/questions/60284943/updating-systemjs-from-0-21-to-6-x-with-webpack => The thing I do not know to migrate is the SystemJS.newModule, as it does not exist in SystemJS 6 anymore. Any advice would be greatly appriciated!
Guy Bedford
@guybedford
@resolvethis you can use System.set instead of System.registry.set, then you likely want to use a resolved URL for those dependencies configured via an import map.
If you look for System.set examples in the issue queue I'm sure you should find a similar answer
For example see systemjs/systemjs#2152
Michiel Vermandel
@resolvethis
Thanks a lot, I managed to get it working! See https://stackoverflow.com/a/63917606/2528609 for details
Charlie Matters
@charliematters
Hello! I'm sorry this is a super-old question, but we're using 0.21.0 as part of a dynamically fetched system and I'm trying to work out how to externalise react and react-dom. The outer application is built using webpack, and I've got that happily putting the UMD builds of react/dom as script imports in the html file, but I'm not sure how I can tell systemjs that import React from 'react' is already provided and doesn't need fetching. Any ideas?
rickszyr
@rickszyr
Hi All
Is this still active?

I have the following issue:

I'm loading a remote module using Angular & SystemJS

the first module I load, loads perfectly fine
the second module I load that depends on that remotely loaded module throws the following error
Error: Unable to resolve bare specifier 'plugin1'
image.png
this is what i'm using to load the modules
image.png
rickszyr
@rickszyr
this is how I pre-register all modules
rickszyr
@rickszyr
So I finally understood that the problem is that the import map cannot be updated, is that possible?
Guy Bedford
@guybedford
rickszyr
@rickszyr
AWESOME! @guybedford thanks.
rickszyr
@rickszyr
Is it the same as invoking SystemJs.prepareImport(true) before setting the map for each module?
image.png
Guy Bedford
@guybedford
@rickszyr yes you just have to call it with the true argument.
rickszyr
@rickszyr
:clap: :clap: understanding how the pipelines work beneath the city is always satisfying. Thanks for your support Guy
prof-schnitzel
@prof-schnitzel
Hello everyone, I saw in some code snippets that you can use @empty, if you want to ignore a module. However, when using System.resolve('@empty') I just get the exception Unable to resolve bare specifier '@empty'. Is that feature not working anymore?
Andreas Hallberg
@bobby-tables:matrix.org
[m]

Hi all!
We're currently running an old version of SystemJS (0.20.19) and would like to upgrade to the newest version. One issue is that our app depends on external modules that uses System.registerDynamic(). These modules are loaded dynamically at runtime from an external URL (think: micro frontend setup).

I have tried to add hooks to map the registerDynamic calls to register, but without success. Is there any guide on how to do this and/or perhaps a way to transpile the module during import?

Andreas Hallberg
@bobby-tables:matrix.org
[m]

Oh and a separate but equally important question:
These dynamically loaded modules should re-use dependencies that are declared/loaded by our app (an Angular CLI app with webpack). In the past we have done this:

import * as rxjs from "rxjs";

SystemJS.set("rxjs", SystemJS.newModule(rxjs));

Is there perhaps a way to hook into the System dependency resolution such that:

  System.someModuleRequires(moduleName => {
    if (moduleName === "rxjs") {
      return import("rxjs"); // Import webpack bundle
    } else {
      // Default handler
    }
  })

Thanks in advance

Andreas Hallberg
@bobby-tables:matrix.org
[m]

:point_up: Edit: Oh and a separate but equally important question:
These dynamically loaded modules should re-use dependencies that are declared/loaded by our app (an Angular CLI app with webpack). In the past we have done this:

import * as rxjs from "rxjs";

SystemJS.set("rxjs", SystemJS.newModule(rxjs));

Is there perhaps a way to hook into the System dependency resolution such that:

  System.someModuleRequires(moduleName => {
    if (moduleName === "rxjs") {
      return import("rxjs"); // Import webpack bundle
    } else {
      // Default handler
    }
  })

Note: I guess this one would be System.set, but with a promise that resolves to a module (or a function that returns a promise):

System.set("rxjs", () => import("rxjs"))

Thanks in advance

Vernon Kesner
@vernonk

Hello... Sorry if I'm missing this somewhere, but is there an example, article, etc anywhere that goes into using Cypress and SystemJS together? I have a utility MFE that I need to import but when trying to run Cypress tests it obviously can't resolve the import (e.g. import doSomething from '@projectname/myutilmfe').

I've tried adding @cypress/webpack-preprocessor passing in the webpack config to webpackOptions, but I obviously don't have the import-maps and such. Any pointers or links would be super helpful.

Leif
@leifandersen:matrix.org
[m]
Hey all, I'm trying to import a UMD module that relies on react (which is separately loaded), but when I try to do this, I get a react not found error.
It seems like systemjs should be able to handle this (with the amd extra), but I'm kind of at a loss for how to do this.
(The react module loads fine, but I have the other one as a data URI.)
Does anyone have any resources they could point me to on how to do this?
Leif
@leifandersen:matrix.org
[m]
What I have so far is something along the lines of:
<script type="systemjs-importmap">
{
  "imports": {
    "react": "app:react"
  }
}
</script>
<script>
  window.react = <react>;
  window.moduri = <module-uri>;
  System.set("app:react", window.react);
  System.import("react");
  System.import(moduri); // Error, cannot find `react`
</script>
(I know I could use webpack to bundle the UMD module with react so there is no dependency, but since I need react separately from that module, it seems silly to me to load two instances of react into the page.)
Leif
@leifandersen:matrix.org
[m]
(Oh, I also know that System.set is not recommended for normal use, but in this case I specifically will want the ability to hot-reload modules.)
Leif
@leifandersen:matrix.org
[m]
Hmm...actually, it looks like the module might have just been bad.
(I built it with browserify using the -x flag.)
Thanks anyway. :)
Leon Heess
@leonheess
Hi everyone! I'm getting Error: Unable to resolve bare specifier in my unit tests which makes sense because no import map exists here but how can I properly mock it?
frank-dspeed
@frank-dspeed:matrix.org
[m]
Little update from me starting tc39 proposal for importScripts() to get integrated directly into the ECMAScript Standard will post link soon if some one wants to join that effort