Comments (9)
I think, you could remove the call to enableProdMode
in the bundles and call it directly in an script after referenceing core.umd.js:
<script>
ng.core.enableProdMode();
</script>
from ngx-build-plus.
@manfredsteyer I know this issue is closed but when using the method below, along with the ngx-build-plus externals schematic I get the following error:
Uncaught Error: Cannot enable prod mode after platform setup.
It seems like the umd js files get bundled into scripts.js but the enableProdMode function needs to run after scripts.js but before main.js. Is there a way to acheive this or should I just not bundle the umd files?
I think, you could remove the call to
enableProdMode
in the bundles and call it directly in an script after referenceing core.umd.js:<script> ng.core.enableProdMode(); </script>
from ngx-build-plus.
Feel free to repoen this issue, if this is not the solution.
from ngx-build-plus.
Yes, that seems to have done the trick. Thanks!
from ngx-build-plus.
@manfredsteyer Shoudnt this be mentioned in the readme and in your blog post? Because ngx-build-plus is all about having multiple web components on one page and share their externals. But following the readme results in exactly this error when having at least two web components on one page.
Another issue is that this way we cant use defer:
<script src="dist/polyfills.js" defer></script>
<script src="dist/scripts.js" defer></script>
<script>
window.ng.core.enableProdMode();
</script>
<script src="dist/main.js" defer></script>
Further it is not reliable to have the consumers of the web components call enableProdMode()
. The Next.js developers that are implementing my web components do have problems doing that und need my scripts to do so instead.
from ngx-build-plus.
@MickL also looking for better solutions, but till then, we actually wrapped the enableProdMode() inside a try catch, so we dont have to change anything on the client.
from ngx-build-plus.
I did the same! :)
from ngx-build-plus.
Wrapped it, logged it. This needs to get addressed though.
from ngx-build-plus.
I am working on microfrontends using angular module federarion. In local the remote apps working fine in shell app. I deployed apps in node server using express js and running production mode. I am getting error "Cannot enable prod mode after platform setup." Can you please tell the solution for this error. @manfredsteyer.
Thank you for Module Federation to make easy of creating micro frontends
from ngx-build-plus.
Related Issues (20)
- Angular v15.2.0 --single-bundle not working
- lazy elements module keep loading the MFE in an infinite loop.
- Automatically page refreshing on Angular webcomponent
- Angular hot load server is having very poor performance
- i'm facing this issue
- no able to update to 15
- Can't add to library - expected node expected node projects/foo/architect/serve in angular.json HOT 2
- Externals schematics references non existend files (*.umd.js) HOT 1
- How does environment variable injection work in ssr? Please provide docs HOT 1
- Unable to serve language files with MFE.
- Unable to run additional webpack configurations in NX workspace HOT 3
- Angular 17 support HOT 3
- New esbuild builder support HOT 1
- ngx-build-plus and the new build system @angular-devkit/build-angular:application
- What are the differences between this package and `@angular-devkit/build-webpack`?
- Update this repo with the lates please so old
- Extra configuration possibilities for Native Module Federation with Angular HOT 2
- Unable to build Angular 17 PWA fails with Data path "/serviceWorker" must be boolean
- Data path "" must have required property 'main'. Angular 17 (maybe sinceAngular 16?)
- No more provideExperimentalZonelessChangeDetection in Angular 18.0.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-build-plus.