GithubHelp home page GithubHelp logo

Comments (9)

manfredsteyer avatar manfredsteyer commented on June 26, 2024 2

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.

mzmoosa01 avatar mzmoosa01 commented on June 26, 2024 1

@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.

manfredsteyer avatar manfredsteyer commented on June 26, 2024

Feel free to repoen this issue, if this is not the solution.

from ngx-build-plus.

akrueger avatar akrueger commented on June 26, 2024

Yes, that seems to have done the trick. Thanks!

from ngx-build-plus.

MickL avatar MickL commented on June 26, 2024

@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.

DiogoVCS avatar DiogoVCS commented on June 26, 2024

@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.

MickL avatar MickL commented on June 26, 2024

I did the same! :)

from ngx-build-plus.

sswayney avatar sswayney commented on June 26, 2024

Wrapped it, logged it. This needs to get addressed though.

from ngx-build-plus.

JagadishNM avatar JagadishNM commented on June 26, 2024

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

image

from ngx-build-plus.

Related Issues (20)

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.