Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 11 16:41
    saak23 opened #2341
  • Jun 11 08:38
    billy-reilly commented #2310
  • Jun 10 11:53
    github-actions[bot] commented #2340
  • Jun 10 11:52
    zhoukekestar opened #2340
  • Jun 10 11:49
    zhoukekestar commented #2339
  • Jun 10 11:48
    zhoukekestar commented #2339
  • Jun 10 11:47
    zhoukekestar commented #2339
  • Jun 10 11:45
    zhoukekestar commented #2339
  • Jun 10 11:38
    zhoukekestar edited #2339
  • Jun 10 11:37
    zhoukekestar edited #2339
  • Jun 10 11:37
    zhoukekestar opened #2339
  • Jun 08 16:49
    StuffOfInterest opened #2338
  • Jun 08 11:35
    StuffOfInterest commented #2337
  • Jun 08 11:34
    StuffOfInterest commented #2337
  • Jun 08 11:30
    StuffOfInterest commented #2337
  • Jun 08 01:35
    StuffOfInterest commented #2337
  • Jun 07 22:04
    mk-pmb commented #2317
  • Jun 07 21:45
    StuffOfInterest edited #2337
  • Jun 07 21:44
    StuffOfInterest commented #2337
  • Jun 07 18:41
    joeldenning commented #2336
Frank Lemanschik
@frank-dspeed
depends on your code
Guy Bedford
@guybedford
@eddneal we do both because we want to ensure scripts are loaded as soon as possible. This does bring up an interesting feature idea though, if we should support eg defer on type=systemjs-module for your use case. I would in general think that this would be unadvisable though since any delay = direct performance issues for the user (especially since these scripts aren't preloaded by the browser preloader as it does not understnad them).
1 reply
Perhaps you could explain a little more about your use case why this is necessary
@stevenvachon System.set should be set with full URLs usually if you can. prepareImport is just for loading the import map initially. Updating the import map after that prepareImport is a use case we have yet to support, but are currently matching what browser import maps provide.
4 replies
Guy Bedford
@guybedford
Exactly - import maps spec is now frozen and doesn’t support updates
It does support dynamic injection before the first module load, but so does systemjs
After the first module load they are frozen
I’ve created http://github.com/guybedford/import-maps-extensions to get movement on new spec work for these sorts of cases
Will post to WICG when import maps unflag
Steven Vachon
@stevenvachon
oh
so, then you wouldn't be interested in a PR
@guybedford if you're aware of any hacks i can use (i'm using jest), please post them to the github issue i created
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.