single-spa | The router for easy microfrontends | Single Page Application library
kandi X-RAY | single-spa Summary
Support
Quality
Security
License
Reuse
- Re - route
- Mounts the parcel or the parcel of the specified parcel .
- Load an app into a loading process .
- Reactivate app changes
- Ensure that the configuration is valid .
- Convert a dynamic path to a regular expression
- Retrieve detailed information for each app .
- Returns a promise that will be resolved to a timeout .
- Unload an an app
- Unloads an app .
single-spa Key Features
single-spa Examples and Code Snippets
Trending Discussions on single-spa
Trending Discussions on single-spa
QUESTION
I am trying to run test for my react application in which I used @ import such as
import { something } from "@atoms";
I did the mapping in the tsconfig.json file and it s used correctly when I run the application (command: "webpack serve --port 9004") but when I try to test (command "cross-env BABEL_ENV=test jest") the imports fails with this error:
Configuration error:
Could not locate module @atoms mapped as:
[
"src/components/atoms/index"
].
Please check your configuration for these entries:
{
"moduleNameMapper": {
"/@atoms/": "[
"src/components/atoms/index"
]"
},
"resolver": undefined
}
1 | import { ReactElement } from "react";
2 |
> 3 | import { Something } from "@atoms";
| ^
4 |
5 |
6 | export const SomethingElse = ({
at createNoMappedModuleFoundError (../node_modules/jest-resolve/build/resolver.js:579:17)
at Object. (components/molecules/SomethingElse/index.tsx:3:1)
jest.config.js:
const { compilerOptions } = require("./tsconfig.json");
module.exports = {
rootDir: "src",
testEnvironment: "jsdom",
transform: {
"^.+\\.(j|t)sx?$": "babel-jest",
},
moduleNameMapper: {
"\\.(sass)$": "identity-obj-proxy",
"single-spa-react/parcel": "single-spa-react/lib/cjs/parcel.cjs",
...compilerOptions.paths,
},
setupFilesAfterEnv: ["@testing-library/jest-dom"],
};
tsconfig.json:
{
"extends": "ts-config-single-spa",
"compilerOptions": {
"jsx": "react-jsx",
"target": "ES5",
"baseUrl": ".",
"paths": {
"@app/*": ["src/*"],
"@configs/*": ["src/configs/*"],
"@configs": ["src/configs/index"],
"@components/*": ["src/components/*"],
"@components": ["src/components/index"],
"@constants/*": ["src/constants/*"],
"@constants": ["src/constants/index"],
"@enums/*": ["src/enums/*"],
"@enums": ["src/enums/index"],
"@hooks/*": ["src/hooks/*"],
"@hooks": ["src/hooks/index"],
"@services/*": ["src/services/*"],
"@services": ["src/services/index"],
"@store/*": ["src/store/*"],
"@store": ["src/store/index"],
"@themes/*": ["src/themes/*"],
"@themes": ["src/themes/index"],
"@utils/*": ["src/utils/*"],
"@utils": ["src/utils/index"],
"@types/*": ["src/types/*"],
"@types": ["src/types/index"],
"@assets/*": ["public/assets/*"],
"@atoms": ["src/components/atoms/index"],
"@molecules": ["src/components/molecules/index"],
"@organisms": ["src/components/organisms/index"],
"@pages": ["src/components/organisms/pages/index"]
}
},
"files": ["src/main-file.tsx"],
"include": ["src/**/*"]
}
ANSWER
Answered 2022-Apr-04 at 17:37I use the tsconfig-paths-jest npm package to add this to use the pathing from the tsconfig.json.
To add it into my Jest setup, I have this in the jest configuration script file (.js)
const tsconfig = require('./tsconfig.json');
const moduleNameMapper = require('tsconfig-paths-jest')(tsconfig);
module.exports = {
moduleNameMapper,
...
};
QUESTION
I have a single spa application with a root-config, a styleguide, and a couple of react applications. All of these application are generated using the yarn create single-spa
command.
I tried creating a kit
from the font-awesome website and adding it to the root-config index.ejs inside the head
tag.
Then I tried adding in one of my MFEs. The loaded index.html in my browser include the tag code. But it's dimensions are 0x0.
ANSWER
Answered 2022-Mar-15 at 19:08You are missing some styles.
When you generate your kit
, the font awesome website shares a snippet of the script
tag for your kit. You need to place it in the head
section of your root-config
. But that's not all. You also need to add some font-faces
.
The same page (with the snippet) also has a link to download example html file. If you check that file it has extra style
tags. Once you add those to your root-config
, the icons will start showing up.
This issue is not single-spa, it's the confusing documentation for font-awesome.
QUESTION
After upgrading react-scripts to v5, craco start
does not work properly. App starts with no error but in browser, there is a blank page and if i open inspector, i only see index.html codes not react codes. It was working well with react-scripts@4.0.3. Here is my local files;
package.json
{
"name": "test-app",
"private": true,
"version": "0.1.0",
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"dependencies": {
...
"@babel/preset-react": "^7.16.7",
...
"@craco/craco": "^6.4.3",
...
"babel-loader": "^8.2.3",
...
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-scripts": "^5.0.0",
"scriptjs": "^2.5.9",
"single-spa": "^5.9.0",
"single-spa-react": "^4.6.1",
},
"devDependencies": {
"@babel/core": "7.7.2",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.17.2",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
"@svgr/webpack": "6.2.1",
"@types/chance": "^1.0.8",
"@types/jest": "^24.9.0",
"@types/node": "^16.7.10",
"@types/react": "^16.9.18",
"@types/react-dom": "^16.9.5",
"@types/react-router-dom": "^5.1.3",
"@types/yargs": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"@webpack-cli/serve": "^1.6.1",
"compression-webpack-plugin": "^9.2.0",
"css-loader": "3.2.0",
"dotenv": "^10.0.0",
"dotenv-expand": "5.1.0",
"dotenv-webpack": "^7.1.0",
"env-path": "^1.0.7",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^7.11.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-react-app": "^6.0.0",
"eslint-config-standard": "^14.1.0",
"eslint-config-standard-jsx": "^8.1.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-flowtype": "5.2.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-standard": "^4.0.1",
"file-loader": "4.2.0",
"react-app-rewired": "^2.2.1",
"react-svg-loader": "^3.0.3",
"react-test-renderer": "^16.11.0",
"sass-loader": "8.0.0",
"style-loader": "1.0.0",
"systemjs-webpack-interop": "^2.3.7",
"terser-webpack-plugin": "5.3.1",
"tsconfig-paths-webpack-plugin": "^3.5.1",
"url-loader": "2.2.0",
"webpack": "^5.69.1",
"webpack-cli": "^4.9.2",
"webpack-manifest-plugin": "4.1.1",
"workbox-webpack-plugin": "6.4.2",
"yargs": "^17.1.1"
},
"scripts": {
"version": "node scripts/version.js",
"solid": "node scripts/solid.js",
"start": "craco start",
"build": "craco build"
},
"typings": "./src"
}
craco.config.ts
export default {
mode: 'development',
babel: {
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
},
eslint: {
enable: false,
},
webpack: {
configure: (webpackConfig) => {
// add this line
// use System
webpackConfig.output.libraryTarget = 'system';
delete webpackConfig.optimization;
webpackConfig.externals = [
'react',
'react-dom',
'single-spa',
'react-router',
'react-router-dom',
'@mf-experiences',
];
return webpackConfig;
},
},
// Adding Server
devServer: (devServerConfig) => {
devServerConfig.proxy = {
'@mf-experiences': {
target: 'path...',
secure: false,
changeOrigin: true,
},
};
return devServerConfig;
},
};
src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './styles/nullifier.scss';
import './styles/index.scss';
import './tracking/facebook.ts';
import App from './App';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
const setRealVh = () => {
document.documentElement.style.setProperty(
'--vh',
`${window.innerHeight * 0.01}px`
);
};
window.addEventListener('resize', setRealVh);
document.documentElement.style.setProperty('--intensity', `${768 * 0.005}px`);
ReactDOM.render(, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://cra.link/PWA
// serviceWorkerRegistration.register({
// onUpdate: (registration) => registration.waiting.postMessage({ type: 'SKIP_WAITING' }),
// });
serviceWorkerRegistration.unregister();
ANSWER
Answered 2022-Feb-23 at 10:05craco
's Github readme, states that it is supporting Create React App (CRA) 4.*
. By this statement, I'm assuming CRA 5
is not officially supported by craco
.
However, this repository utilizes both CRA 5
and craco
(but I have not verified that it is working). Use this repository to compare your setup (after verifying that the linked repositry is working), and try different settings/configs to see if you get further.
QUESTION
Tell me, I understand that there is a problem in the versions, but how to solve it?
I have tried:
npm cache clean --force commands
npm install -g npm-install-peers
npm install --legacy-peer-deps
"name": "",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"serve:standalone": "vue-cli-service serve --mode standalone"
},
"dependencies": {
"core-js": "^3.6.5",
"devextreme": "21.2.5",
"devextreme-vue": "21.2.5",
"single-spa-vue": "^2.1.0",
"vue": "^2.6.11"
},
"devDependencies": {
"@storybook/vue": "^6.4.14",
"@vue/cli": "^4.5.15",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"node-sass": "^6.0.1",
"sass-loader": "^10",
"eslint-plugin-vue": "^6.2.2",
"vue-cli-plugin-single-spa": "~3.1.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
ANSWER
Answered 2022-Feb-07 at 14:29That is because you're trying to install Vuex@4, which is only compatible with Vue@3. However, your project is using Vue@2 instead.
You will need to decide which Vue version you want to use. Since you mentioned that you only want to use Vue2, you need to install the Vuex@3 instead:
npm install vuex@3
QUESTION
I work with microfrontend single-spa (https://single-spa.js.org/) I create a store
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
count: 0
},
mutations: {
}
})
in src/main.js i import it
import Vue from 'vue';
import singleSpaVue from 'single-spa-vue';
import 'devextreme/dist/css/dx.light.css';
import App from './App.vue';
import store from './store';
console.log("🚀 ~ file: main.js ~ line 6 ~ store", store)
Vue.config.productionTip = false;
Vue.prototype.$bus = new Vue();
const vueLifecycles = singleSpaVue({
store,
Vue,
appOptions: {
render(h) {
return h(App, {
store,
props: {
},
});
},
},
});
export const bootstrap = vueLifecycles.bootstrap;
export const mount = vueLifecycles.mount;
export const unmount = vueLifecycles.unmount;
in console.log store displayed, but in the app cnsole.log(this) does not contain store
I don't understand where I am connecting wrong?
ANSWER
Answered 2022-Feb-07 at 12:12According to the docs, store
should be a subproperty of appOptions
:
const vueLifecycles = singleSpaVue({
// store, ❌
Vue,
appOptions: {
store, ✅
render(h) {
return h(App, {
// store, ❌
props: {},
})
},
},
})
QUESTION
After a recent angular 12 upgrade I am unable to see my .ts files inside sources in Dev tool. The web pack bundler doesn't seems to be loaded. sourceMap in angular.json is true still the files are not loading. Anyone please let me know what all things I need to check here. This is an inconvenience as I generally debug through the browser.Below is the content of my angular Json file.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"load-board": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "ntg-load-board",
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"outputPath": "dist/out",
"index": "src/index.html",
"main": "src/main.single-spa.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/@ntgfreight/ui-components/style/style.scss",
"src/styles.scss"
],
"scripts": [],
"customWebpackConfig": {
"path": "extra-webpack.config.js",
"libraryName": "load-board",
"libraryTarget": "umd"
}
},
"configurations": {
"dev": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.dev.ts"
}
],
"optimization": true,
"outputHashing": "none",
"sourceMap": true,
"namedChunks": true,
"extractLicenses": false,
"vendorChunk": true,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
},
"qa": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.qa.ts"
}
],
"optimization": true,
"outputHashing": "none",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
},
"stg": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stg.ts"
}
],
"optimization": true,
"outputHashing": "none",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
},
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "none",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "load-board:build"
},
"configurations": {
"production": {
"browserTarget": "load-board:build:production"
},
"development": {
"browserTarget": "load-board:build:dev"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "load-board:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/@ntgfreight/ui-components/style/style.scss",
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "load-board:serve"
},
"configurations": {
"production": {
"devServerTarget": "load-board:serve:production"
}
}
}
}
}
},
"defaultProject": "load-board",
"cli": {
"analytics": false
}
}
enter code here
ANSWER
Answered 2021-Oct-01 at 11:55You need to to update your serve section to include the development browserTarget
to dev configuration:
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "load-board:build"
},
"configurations": {
"production": {
"browserTarget": "load-board:build:production"
},
"development": {
"browserTarget": "load-board:build:dev"
}
}
},
And run your project using:
ng serve load-board --configuration development
Read more about Angular12: https://blog.angular.io/angular-v12-is-now-available-32ed51fbfd49
QUESTION
I have downloaded the npm i --save esri-loader @esri/react-arcgis but why is it i cant load the map? did i miss something?
import React from 'react';
import Map from '../../component/Map/Map.js'
const HomePage = () => {
return (
);
};
export default HomePage;
component/Map/Map.js
import React , {useRef,useEffect} from 'react';
import {loadModules} from "esri-loader";
function Map() {
const MapElement=useRef(null)
useEffect(()=>{
let view;
loadModules(["esri/views/MapView", "esri/WebMap"],{
css:true
}).then(([MapView, WebMap])=>{
const webmap= new WebMap({
basemap:'topo-vector'
})
view = new MapView({
map:webmap,
center:[],
zoom:8,
container:MapElement.current
})
})
return()=>{
if(!!view){
view.destroy()
view=null
}
}
})
return (
)
}
export default Map
the error i get
the reference i used for this https://www.youtube.com/watch?v=0RC1Xf_0UUk
package.json
{
"name": "@country/app", "private": true, "scripts": {
"start": "webpack serve",
"start:standalone": "webpack serve --port 9003 --env standalone",
"build": "concurrently yarn:build:*",
"build:webpack": "webpack --mode=production",
"analyze": "webpack --mode=production --env analyze",
"lint": "eslint src --ext js",
"format": "prettier --write .",
"check-format": "prettier --check .",
"test": "cross-env BABEL_ENV=test jest",
"watch-tests": "cross-env BABEL_ENV=test jest --watch",
"prepare": "husky install",
"coverage": "cross-env BABEL_ENV=test jest --coverage" }, "devDependencies": {
"@arcgis/webpack-plugin": "^4.20.0",
"@babel/core": "^7.15.0",
"@babel/eslint-parser": "^7.15.0",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@babel/runtime": "^7.15.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"babel-jest": "^27.0.6",
"concurrently": "^6.2.1",
"cross-env": "^7.0.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^3.4.1",
"husky": "^7.0.4",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.4.3",
"jest-cli": "^27.4.3",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0",
"webpack-config-single-spa-react": "^4.0.0",
"webpack-dev-server": "^4.0.0",
"webpack-merge": "^5.8.0" }, "dependencies": {
"@esri/react-arcgis": "^5.1.0",
"@material-ui/styles": "^4.11.4",
"@mui/styles": "^5.2.2",
"@reach/router": "^1.3.4",
"arcgis-js-api": "^4.21.2",
"esri-loader": "^3.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"single-spa-react": "^4.3.1" }, }
ANSWER
Answered 2022-Jan-04 at 16:36Sorry for not directly responding to your described error, but I would not use esri-loader with newer versions of ArcGIS for JavaScript API. Why not npm as ES modules which do not require a separate script loader?
This way you can do simple imports like this:
import WebMap from "@arcgis/core/WebMap";
Here are the initial setup instructions:
Finally, here is a sample react app from Esri using exactly that:
QUESTION
When we are trying to update our Angular 9 application(Single SPA micro frontend) to Angular 12 we are facing bellow issue.
Error on console when trying to run this app:
An unhandled exception occurred: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.output has an unknown property 'chunkLoadingGlobal'. These properties are valid: object { auxiliaryComment?, chunkCallbackName?, chunkFilename?, chunkLoadTimeout?, crossOriginLoading?, devtoolFallbackModuleFilenameTemplate?, devtoolLineToLine?, devtoolModuleFilenameTemplate?, devtoolNamespace?, filename?, futureEmitAssets?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateFunction?, hotUpdateMainFilename?, jsonpFunction?, jsonpScriptType?, library?, libraryExport?, libraryTarget?, path?, pathinfo?, publicPath?, sourceMapFilename?, sourcePrefix?, strictModuleExceptionHandling?, umdNamedDefine?, webassemblyModuleFilename? } -> Options affecting the output of the compilation.
output
options tell webpack how to write the compiled files to disk. See "C:\Users***\AppData\Local\Temp\ng-UWsPRm\angular-errors.log" for further details..
Package.json:
"name": "my-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "npm run serve",
"devstart": "ng serve --aot=false",
"build": "npm run build",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular-builders/custom-webpack": "^10.0.0",
"@angular-devkit/architect": "^0.1202.13",
"@angular-devkit/build-angular": "^12.2.13",
"@angular-devkit/core": "^12.2.13",
"@angular-devkit/schematics": "^12.2.13",
"@angular/animations": "^12.2.14",
"@angular/cdk": "^12.2.13",
"@angular/common": "^12.2.14",
"@angular/compiler": "^12.2.14",
"@angular/core": "^12.2.14",
"@angular/forms": "^12.2.14",
"@angular/localize": "^12.2.14",
"@angular/material": "^12.2.13",
"@angular/platform-browser": "^12.2.14",
"@angular/platform-browser-dynamic": "^12.2.14",
"@angular/router": "^12.2.14",
"@elastic/apm-rum": "^4.5.1",
"@elastic/apm-rum-angular": "^0.5.0",
"@fortawesome/angular-fontawesome": "0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-solid-svg-icons": "5.6.3",
"@grapecity/spread-excelio": "^12.0.10",
"@grapecity/spread-sheets": "^12.0.10",
"@grapecity/spread-sheets-angular": "^12.0.10",
"@grapecity/spread-sheets-charts": "^12.0.10",
"@highcharts/map-collection": "^1.1.2",
"@ng-bootstrap/ng-bootstrap": "^5.1.4",
"@ng-select/ng-select": "^2.17.0",
"@ngx-translate/core": "11.0.1",
"@ngx-translate/http-loader": "4.0.0",
"@syncfusion/ej2-angular-dropdowns": "^17.4.43",
"@types/jquery": "^3.3.29",
"@types/selenium-webdriver": "^4.0.9",
"@types/sockjs-client": "^1.1.1",
"@types/stompjs": "^2.3.4",
"add": "^2.0.6",
"ag-grid": "^18.1.2",
"ag-grid-angular": "^20.2.0",
"ag-grid-community": "^20.2.0",
"ag-grid-enterprise": "^20.2.0",
"angular-highcharts": "^7.2.0",
"bootstrap": "4.2.1",
"core-js": "^2.5.7",
"crypto-js": "^3.1.9-1",
"e": "0.0.4",
"fund": "^1.0.0",
"highcharts": "^7.1.0",
"highcharts-angular": "^2.4.0",
"highcharts-exporting": "^0.1.7",
"html2canvas": "^1.0.0-rc.1",
"jquery": "^3.4.1",
"jquery-ui-dist": "^1.12.1",
"jspdf": "^1.5.3",
"keycloak-angular": "^6.0.0",
"moment": "2.24.0",
"net": "^1.0.2",
"ng": "0.0.0",
"ng-jhipster": "^0.11.5",
"ng-multiselect-dropdown": "^0.2.3",
"ngx-cookie": "2.0.1",
"ngx-dual-listbox": "^0.2.0",
"ngx-infinite-scroll": "7.0.1",
"ngx-monaco-editor": "^8.1.1",
"ngx-spinner": "^7.0.0",
"ngx-webstorage": "^5.0.0",
"percentile": "^1.2.2",
"primeflex": "^1.1.0",
"primeicons": "^2.0.0",
"primeng": "^9.1.3",
"rxjs": "^6.5.3",
"scss-dependency": "^1.2.0",
"single-spa": "^5.9.3",
"single-spa-angular": "^5.0.1",
"slavede-ng-dual-list-box": "^1.1.5",
"stompjs": "^2.3.3",
"swagger-ui": "2.2.10",
"terser": "^3.16.1",
"tslib": "^2.0.0",
"typescript": "^4.3.5",
"underscore": "^1.9.1",
"webpack": "^5.65.0",
"webpack-5-chain": "^8.0.0",
"webpack-dev-server": "^4.6.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^10.0.0",
"@angular/cli": "^12.2.13",
"@angular/compiler-cli": "^12.2.14",
"@ngtools/webpack": "^8.3.20",
"@types/chai": "4.1.7",
"@types/chai-string": "1.4.1",
"@types/jest": "^23.3.13",
"@types/mocha": "5.2.5",
"@types/node": "^10.12.18",
"angular-router-loader": "0.8.5",
"angular2-template-loader": "0.6.2",
"autoprefixer": "9.4.6",
"browser-sync": "2.26.3",
"browser-sync-webpack-plugin": "2.2.2",
"cache-loader": "2.0.1",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"chai-string": "1.5.0",
"codelyzer": "^6.0.0",
"copy-webpack-plugin": "4.6.0",
"css-loader": "2.1.0",
"file-loader": "3.0.1",
"fork-ts-checker-webpack-plugin": "0.5.2",
"friendly-errors-webpack-plugin": "1.7.0",
"generator-jhipster": "5.8.1",
"html-loader": "0.5.5",
"html-webpack-plugin": "3.2.0",
"husky": "1.3.1",
"jest": "^27.4.3",
"jest-junit": "12.3.0",
"jest-preset-angular": "^11.0.1",
"jest-sonar-reporter": "2.0.0",
"lint-staged": "8.1.0",
"mini-css-extract-plugin": "0.5.0",
"mocha": "5.2.0",
"moment-locales-webpack-plugin": "1.0.7",
"optimize-css-assets-webpack-plugin": "5.0.1",
"postcss-loader": "3.0.0",
"prettier": "1.16.1",
"protractor": "~7.0.0",
"reflect-metadata": "0.1.13",
"rimraf": "2.6.3",
"simple-progress-webpack-plugin": "1.1.2",
"style-loader": "0.23.1",
"terser-webpack-plugin": "^1.2.1",
"thread-loader": "2.1.1",
"to-string-loader": "^1.1.5",
"ts-loader": "5.3.3",
"ts-node": "8.0.1",
"tslint": "~6.1.0",
"tslint-config-prettier": "1.17.0",
"tslint-loader": "3.6.0",
"webpack-cli": "3.2.1",
"webpack-merge": "4.2.1",
"webpack-notifier": "1.7.0",
"webpack-visualizer-plugin": "0.1.11",
"workbox-webpack-plugin": "3.6.3",
"write-file-webpack-plugin": "4.5.0"
}
}
ANSWER
Answered 2021-Dec-16 at 14:06kindly update the custom-webpack with ^12.1.3
"@angular-builders/custom-webpack": "^12.1.3",
QUESTION
I already add this to my package.json dist/custom-elements/index.mjs": "dist/custom-elements/index.js why i am having this error (below). did i miss something?
{
"name": "@map/react-app",
"private": true,
"scripts": {
"start": "webpack serve",
"start:standalone": "webpack serve --port 9003 --env standalone",
"build": "concurrently yarn:build:*",
"build:webpack": "webpack --mode=production",
"analyze": "webpack --mode=production --env analyze",
"lint": "eslint src --ext js",
"format": "prettier --write .",
"check-format": "prettier --check .",
"test": "cross-env BABEL_ENV=test jest",
"watch-tests": "cross-env BABEL_ENV=test jest --watch",
"prepare": "husky install",
"coverage": "cross-env BABEL_ENV=test jest --coverage"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/eslint-parser": "^7.15.0",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@babel/runtime": "^7.15.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"babel-jest": "^27.0.6",
"concurrently": "^6.2.1",
"cross-env": "^7.0.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^3.4.1",
"husky": "^7.0.4",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.0.6",
"jest-cli": "^27.0.6",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0",
"webpack-config-single-spa-react": "^4.0.0",
"webpack-dev-server": "^4.0.0",
"webpack-merge": "^5.8.0"
},
"dependencies": {
"@arcgis/core": "^4.21.2",
"@material-ui/styles": "^4.11.4",
"@mui/styles": "^5.2.2",
"@reach/router": "^1.3.4",
"@stencil/core": "^2.11.0",
"browserify": "^17.0.0",
"dotenv": "^10.0.0",
"dotenv-webpack": "^7.0.3",
"path-browserify": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"single-spa-react": "^4.3.1",
"web-vitals": "^2.1.2"
},
"lint-staged": {
"*.{js,jsx}": "pretty-quick --staged && eslint --fix"
},
"browser": {
"dist/custom-elements/index.mjs": "dist/custom-elements/index.js" // I'll already add this to may package.json, why i am having this error?
}
}
error
ERROR in ./node_modules/@esri/calcite-components/dist/custom-elements/index.mjs 1:0-147
Module not found: Error: Can't resolve '@stencil/core/internal/client' in 'C:\Users\Ronald\Desktop\Map\app-react\node_modules@esri\calcite-components\dist\custom-elements' Did you mean 'index.js'? BREAKING CHANGE: The request '@stencil/core/internal/client' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.
ANSWER
Answered 2021-Dec-06 at 23:44The best solutions on this is in your webpack.config.js add this code
module:{
rules:[
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
}
]
},
and removed the browser in your package.json
QUESTION
I would like to design my frontend as a micro frontend project, and I would like to use single-spa. The problem I have is:
I would like to create an application called MF1 as a based structure, it is a react applicant and would have a header, footer, sidebar, and an empty place for main content.
Now, I would like to render other applications inside MF1's main content.
I am familiar with the single-spa layout engine, but the problem with that is the restriction of using a UI framework inside root config project. For example, the sidebar has a button to open and close and it will be handled in a React application, because of this I could not use the single-spa layout engine to make the structure I am looking for or maybe I do not know how.
How can I implement this scenario? Is single-spa a good choice for reaching this feature?
I would like to have something like the below image. header, sidebar, and footer area in the MF1, and based on which menu item is selected, the related micro frontend project would be rendered in the white area.
I will be grateful for any help.
ANSWER
Answered 2021-Nov-25 at 23:32You can perfectly achieve your goal with single-spa. On top of your description, I'll add that you can:
layout the microfrontends inside the root-config add add css grid layout to have the layout described in your screenshot
for the sidebar toggle, you have two options:
make the grid layout responsive inside the root-config: so that when the sidebar collapses, the content of both the main and header fill grows.
propagate an event inside the sidebar when it toggles and make the main and header microfrontends listen to that even inside their own self to modify their width.
When in doubt, please do join our single-spa slack channel, as they recommend.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install single-spa
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page