joeldenning / simple-single-spa-webpack-example

A simple example of how to use webpack with single-spa
MIT License
293 stars 94 forks source link

Support angular 7 #17

Closed yury-kozlov closed 5 years ago

yury-kozlov commented 5 years ago

I tried to run the example with updated angular version (v7 instead of v4) and got multiple errors. At the end, I was able to fix them with the setup below. So if someone needs a working example: here are two basic changes: 1) in webpack.config.js comment out a deprecated plugin: new webpack.optimize.CommonsChunkPlugin({: 'common-dependencies', }), 2) use the following package.json:

{ "name": "simple-single-spa-webpack-example", "version": "1.0.0", "description": "A simple example of how to use webpack with single-spa", "scripts": { "watch": "webpack-dev-server --open", "build": "webpack --config webpack.config.js -p" }, "repository": { "type": "git", "url": "git+https://github.com/joeldenning/simple-single-spa-webpack-example.git" }, "author": "Joel Denning", "license": "MIT", "bugs": { "url": "https://github.com/joeldenning/simple-single-spa-webpack-example/issues" }, "homepage": "https://github.com/joeldenning/simple-single-spa-webpack-example#readme", "devDependencies": { "@angular-devkit/build-angular": "^0.13.1", "@angular/cli": "^7.3.1", "@angular/compiler-cli": "^7.2.4", "@angular/language-service": "^7.2.4", "babel-core": "^6.25.0", "babel-loader": "^7.1.1", "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-preset-env": "^1.6.0", "babel-preset-react": "^6.24.1", "clean-webpack-plugin": "^0.1.16", "http-server": "^0.10.0", "ts-loader": "^5.3.3", "typescript": "^3.3.3", "webpack": "^4.29.3", "webpack-cli": "^3.2.3", "webpack-dev-server": "^3.1.14" }, "dependencies": { "@angular/animations": "^7.2.4", "@angular/common": "^7.2.4", "@angular/compiler": "^7.2.4", "@angular/core": "^7.2.4", "@angular/forms": "^7.2.4", "@angular/http": "^7.2.4", "@angular/platform-browser": "^7.2.4", "@angular/platform-browser-dynamic": "^7.2.4", "@angular/platform-server": "^7.2.4", "@angular/router": "^7.2.4", "ajv": "^6.8.1", "core-js": "^2.6.4", "es6-promise": "^4.1.1", "react": "^15.6.1", "react-dom": "^15.6.1", "reflect-metadata": "^0.1.10", "rxjs": "^6.4.0", "rxjs-compat": "^6.4.0", "single-spa": "^3.8.1", "single-spa-angular2": "^1.2.0", "single-spa-react": "^2.2.0", "zone.js": "^0.8.29" } }

joeldenning commented 5 years ago

Angular 7 is supported with single-spa-angular@3 (which is currently in beta). See https://github.com/CanopyTax/single-spa-angular for more info