Git Product home page Git Product logo

single-spa-examples's Introduction

npm version NPM Downloads

single-spa

Join the chat on Slack

Donate to this project

Official single-spa hosting

baseplate-logo-standard

A javascript framework for front-end microservices

Build micro frontends that coexist and can (but don't need to) be written with their own framework. This allows you to:

Sponsors

DataCamp-Logo Toast-Logo asurion-logo

To add your company's logo to this section:

Documentation

You can find the single-spa documentation on the website.

Check out the Getting Started page for a quick overview.

Demo and examples

Please see the examples page on the website.

Want to help?

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing on the single-spa website.

Contributing

The main purpose of this repository is to continue to evolve single-spa, making it better and easier to use. Development of single-spa, and the single-spa ecosystem happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving single-spa.

Single-spa has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to single-spa.

single-spa-examples's People

Contributors

area73 avatar aresobus avatar blittle avatar dougestey avatar frehner avatar joeldenning avatar joshalling avatar kentmclean avatar oklandon avatar themcmurder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

single-spa-examples's Issues

run install error

F:\single-spa-examples>npm install
npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env no
w: please read https://babeljs.io/env to update!
npm WARN deprecated [email protected]: Please replace with usage of fs.existsSync
npm WARN deprecated [email protected]: Please replace with usage of fs.existsSync
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other
tools.
npm WARN deprecated [email protected]: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least
to actual version of core-js@2.
npm WARN deprecated [email protected]: I wrote this module a very long time ago; you should use something else.
npm ERR! Unexpected end of JSON input while parsing near '...se-only":"^0.8.0-a","'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Benz\AppData\Roaming\npm-cache\_logs\2019-06-10T08_49_51_379Z-debug.log

Broken link in react example.

The link to the huge apps example on this page results in a 404. It should be linking to the 1.0.x branch of the react-router repo since they removed all the examples from master. I can go ahead and submit a PR for this fix.

Explain that child apps can be in separate code repositories

Even though this project doesn't separate child apps into separate code repositories, that does not mean that it isn't possible. See #7 (comment) where @mirandaleandro said

I recommend having at least in comment on the single-spa-examples.js making it explicit that the app code can live anywhere and that System.import will handle it. It just occurred to me that even though this is obvious, you will be dealing with people accessing that code with various skill levels.

Gettin build error

I am getting build error while running the single-spa-examples code.
The Webpack example runs nicely but getting issue when 2 versions of angular are added.
Can you explain a bit on single-spa-examples or how to use multiple versions of angular in
simple-single-spa-webpack-example. I didnt get how to create seperate package.json.

Thanks in advance

Stop uploading all jspm_packages to surge

For some reason, plugin-babel is being downloaded at runtime, but it should only be used at build-time. I believe that the navbar app is the culprit. Once plugin-babel isn't downloaded at runtime, the jspm_packages directory can be ignored from surge completely.

Surge site seems broken

Lastest deploy of https://single-spa.surge.sh/# is only loading a single child application (navbar)

Looking at the deployed file for single-spa-examples.js I see this:

import * as singleSpa from 'single-spa';

singleSpa.declareChildApplication('navbar', () => SystemJS.import('/build/navbar.app.js'), () => true);
// singleSpa.declareChildApplication('home', () => SystemJS.import('/build/home.app.js'), () => location.hash === "" || location.hash === "#");
// singleSpa.declareChildApplication('angular1', () => SystemJS.import('/build/angular1.app.js'), hashPrefix('/angular1'));
// singleSpa.declareChildApplication('react', () => SystemJS.import('/build/react.app.js'), hashPrefix('/react'));
// singleSpa.declareChildApplication('angular2', () => SystemJS.import('/build/angular2.app.js'), hashPrefix('/angular2'));
//
singleSpa.start();

function hashPrefix(prefix) {
	return function() {
		return window.location.hash.indexOf(`#${prefix}`) === 0;
	}
}

I'm guessing they were commented out for development and ran surge command while they were commented out.

angular unmount in angularjs app

in thie demo, we can see, when we switched to angularjs tab, the page concludes two parts, angularjs app and angular app. when we open f12 tools, we can see when switch between angularjs tab and angular tab, the angular app does not unmount. can you help with this issue?

SystemJS not found while cloning the repo and running for the first time

single-spa is very promising library for our microservices architecture and i have been trying to implement it for a few days.But while cloning this repo and running after npm install it throws errors like SystemJS not found(GET /build/system-polyfills.src.js" Error (404): "Not found" , GET /build/common-deps.js" Error (404): "Not found" , GET /build/system.src.js" Error (404): "Not found" , GET /build/shared.src.js" Error (404): "Not found"

single-spa-examples loads very slowly & appears to be using development version of react

Describe the bug or question
The site https://single-spa.surge.sh/react loads very slowly, Seems to download ~7.7MB over 30 seconds on the initial request, which is very bad for the public relations of this software.
Additionally, react-devtools alerts that this site is using development build of react

To Reproduce

  1. Open the URL in chrome while chrome devtools is open
  2. Go to network tab
  3. Hit Ctrl + shift + R
  4. Open react devtools and look at the message

Expected behavior
A clear and concise description of what you expect or hope to happen.

Screenshots and/or console output
image

image

Additional context
I thought about showing this software to my team, but the page took more than 30 seconds to load on my laptop, which was very embarrassing.

Switch to all webpack and no jspm?

Webpack is much more popular and is sort of the community standard. It might make things easier for people to understand and use if webpack is used in this repo rather than jspm

angular phonecat -- going to list of phones

if you first go to the phone list, then click on a phone, and then click on the link at the top to go back to the phone list, you don't actually get sent back to the phone list, despite the url changing.

upgrade to webpack 4 and @babel 7

Would love to use this but reverting our existing codebase from latest versions of webpack and babel to older versions (webpack 3 and babel 6) is a tough sell

Question: Are all applications required at build time?

Ideally, Single-spa app loader would not need to rely on static build time to get new app. I would like to release a build for application A, while not having to do any build for application B. Does single spa allow for this, or would we need to re-build the entire platform whenever an app is updated?

Are there any systemjs examples?

All examples seem to be with webpack. How would we build the apps when they reside in different repos? Any help or suggestions is appreciated. Thx!

yarn build failed with errors

Cloned the github repo instead of following the one in README as it errors out as well, but when I do yarn build, I ran into the following error, what could be the issue? I already reinstalled nodejs to be the latest LTS:

yarn run v1.9.4
$ rimraf build && yarn ember-install && yarn build-ember && yarn build-vanilla && yarn build-webpack
$ cd src/ember-app && yarn && cd ../..
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "ember-inflector@^2.0.0".
[5/5] Building fresh packages...
$ bower install
$ cd src/ember-app && ember build --output-path ../../build/ember-app/ --environment production && cd ../..
cleaning up...
Build failed.
Build Canceled: Broccoli Builder ran into an error with Funnel plugin. 💥
ENOENT: no such file or directory, lstat 'C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\tmp\funnel-input_base_path-WvLdHVls.tmp\bower_components\single-spa-ember\amd\single-spa-ember.js'
Error: ENOENT: no such file or directory, lstat 'C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\tmp\funnel-input_base_path-WvLdHVls.tmp\bower_components\single-spa-ember\amd\single-spa-ember.js'
at Object.fs.lstatSync (fs.js:941:11)
at symlinkWindows (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\symlink-or-copy\index.js:106:25)
at Function.symlinkOrCopySync [as sync] (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\symlink-or-copy\index.js:63:5)
at Funnel._copy (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\broccoli-funnel\index.js:492:19)
at Funnel.processFile (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\broccoli-funnel\index.js:475:8)
at Funnel.applyPatch [as _applyPatch] (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\broccoli-funnel\index.js:389:12)
at Funnel. (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\broccoli-funnel\index.js:343:10)
at Array.forEach ()
at Funnel.processFilters (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\broccoli-funnel\index.js:342:11)
at Funnel.build (C:\Users\XXX\VuePwa\single-spa-examples\src\ember-app\node_modules\broccoli-funnel\index.js:258:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error npm run build

Fails after installation in the build script, the log says:

./bin/build-code
"." it is not recognized as an internal or external command, program or batch file executable.

I'm with windows operating system.

Build process

How would this work in production? If I have apps in different repos, I need to build (i.e. ng build --prod) which produces bundled files with random names, and then dump the output into respective folders. Also what's up with the reference to .ts files?

Missing package.json in single-spa-ember

After cloning the repository I tried to run npm install and it shows this error:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "../single-spa-ember" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alexandermiller/.npm/_logs/2017-10-04T11_10_23_444Z-debug.log

logfile:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.4.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'i' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 2ed2f1c1bfd788d6
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall single-spa-examples@
7 info lifecycle single-spa-examples@~preinstall: single-spa-examples@
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 silly fetchPackageMetaData error for single-spa-ember@file:../single-spa-ember Could not install from "../single-spa-ember" as it does not contain a package.json file.
14 verbose stack Error: ENOENT: no such file or directory, open '/Users/alexandermiller/dev/Projects/single-spa-ember/package.json'
15 verbose cwd /Users/alexandermiller/dev/Projects/single-spa-examples
16 verbose Darwin 16.6.0
17 verbose argv "/usr/local/Cellar/node/8.4.0/bin/node" "/usr/local/bin/npm" "i"
18 verbose node v8.4.0
19 verbose npm  v5.4.2
20 error code ENOLOCAL
21 error Could not install from "../single-spa-ember" as it does not contain a package.json file.
22 verbose exit [ 1, true ]

Hope someone can help with this issue.

Sincerely,
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.