• Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
Thursday, November 19, 2026
No Result
View All Result
Subscribe Now
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    FAA Administrator Takes Responsibility as Mullin Faces Tough Questions Over Nationwide Ground Stop

    FAA Administrator Takes Responsibility as Mullin Faces Tough Questions Over Nationwide Ground Stop

    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Trump Administration Revokes Pay Increase for Head Start Educators

    Trump Administration Revokes Pay Increase for Head Start Educators

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
The Insight Post
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    FAA Administrator Takes Responsibility as Mullin Faces Tough Questions Over Nationwide Ground Stop

    FAA Administrator Takes Responsibility as Mullin Faces Tough Questions Over Nationwide Ground Stop

    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Trump Administration Revokes Pay Increase for Head Start Educators

    Trump Administration Revokes Pay Increase for Head Start Educators

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
No Result
View All Result
No Result
View All Result
Home Mobile

Integrating Swagger UI into Web Apps using Webpack & EmberJs

by Theinsightpost
August 22, 2024
in Mobile
0 0
0
Integrating Swagger UI into Web Apps using Webpack & EmberJs

Reading time:

3 minutes

This article provides a detailed guide on successfully integrating Swagger UI into web applications using EmberJs as the Javascript framework and Webpack as the module bundler. We will cover the step-by-step process, including any challenges encountered along the way and how we resolved them.

For those unfamiliar with Ember Js or Webpack, we have included introductory sections to get you up to speed. If you’re already familiar with it, feel free to skip directly to the integration steps. 

Introduction to Swagger UI

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.

Swagger UI allows anyone—be it your development team or your end consumers—to visualize and interact with the API’s resources without having any of the implementation logic in place. It’s automatically generated from your OpenAPI (formerly known as Swagger) Specification, and the visual documentation makes it easy for back-end implementation and client-side consumption.

Introduction to EmberJs

Ember.js is a productive, battle-tested JavaScript framework for building modern web applications. It includes everything you need to build rich UIs that work on any device. 

It does so by providing developers with many features essential to managing complexity in modern web applications and an integrated development toolkit that enables rapid iteration.

Introduction to Webpack

Webpack is a static module bundler for modern JavaScript applications. When Webpack processes your application, it internally builds a dependency graph from one or more entry points and then combines every module your project needs into one or more bundles, which are static assets to serve your content from.

How to create a new Ember application?

npx ember new ember-swagger-ui --lang en

This command will create a new directory, ember-swagger-ui, and set up a new Ember application inside of it.

Installing Swagger UI

npm install swagger-ui

Note: We are using the latest version of the library (  5.17.14  ) at the time of writing this article.

Installing ember-cli-sass

We need to install ember-cli-sass and node-sass to import styles from swagger-ui.

npm install ember-cli-sass node-sass

 

Adding configuration & import styles

In  ember-cli-build.js: 

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function (defaults) {
  const app = new EmberApp(defaults, {
    // Add options here
    sassOptions: {
      includePaths: ['node_modules/swagger-ui/dist/'],
      implementation: require('node-sass'),
    },
  });
  return app.toTree();
};

In  styles/app.scss  (rename app.css):

@import "swagger-ui";

 

How to create a wrapper component?

  1. Go to app/components.
  2. Create a new folder swagger-ui. 
  3. Inside swagger-ui create files index.html  and index.js.

In  swagger-ui/index.hbs : 

In  swagger-ui/index.js : 

import Component from '@glimmer/component';
import { action } from '@ember/object';

import SwaggerUI from 'swagger-ui';

export default class SwaggerUIComponent extends Component {
  @action
  intializeSwaggerUI(element) {
    SwaggerUI({
      url: 'https://petstore.swagger.io/v2/swagger.json',
      domNode: element,
      presets: [SwaggerUI.presets.apis, SwaggerUI.SwaggerUIStandalonePreset],
    });
  }
}

Add component to  templates/application.hbs  for preview:

{ { page-title "Swagger UI"}}

 

The Polyfill issue in Webpack 5

Now, if we try to start the application, build compilation will fail, and we will see the following error:

ERROR in ./node_modules/xml/lib/xml.js 1:54-78
Module not found: Error: Can't resolve 'stream' in 'path-to-project/node_modules/xml/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'

If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }
resolve 'stream' in 'path-to-project/node_modules/xml/lib'
  Parsed request is a module
  using description file: path-to-project/node_modules/xml/package.json (relative path: ./lib)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module

This is because Webpack 4 automatically poly-filled many node APIs in the browser. This was not a great system because it could lead to surprisingly giant libraries getting pulled into your app by accident, and it gave us no control over the exact versions of the polyfills we were using.

So, Webpack 5 removed this functionality. That means we need to make changes to fix this.

 

Fixing the Polyfill issue in Webpack 5

To fix the build compilation, we need to use the polyfill stream module. Install stream-browserify. 

npm install -D stream-browserify

In  ember-cli-build.js: 

'use strict';const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function (defaults) {
  const app = new EmberApp(defaults, {
    // Add options here
    ...
    autoImport: {
      webpack: {
        // extra webpack configuration goes here
        resolve: {
          fallback: {
            stream: require.resolve('stream-browserify'),
          },
        },
      },
    },
  });
  return app.toTree();
};

Now, build the application again, and we should see the build be successful. But if we check the UI in the browser (open and go to http://localhost:4200), it will be blank. Open the console (press F12), and we will see this error:

A screenshot of the Console showing the error caused by the polyfill issue.

To fix this, we need to add this to the Webpack configuration:

webpack: {
  // extra webpack configuration goes here
  node: {
    global: true,
  },
  ...
},

Let’s build again for the changes to take effect. Now, when we check the browser, the UI still appears to be blank, and there is a new error in the console.

A screenshot of the Console showing a new error after adding an extra Webpack configuration.

Now, we need to polyfill the  buffer module.

npm install -D buffer

In  ember-cli-build.js: 

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const webpack = require('webpack');

module.exports = function (defaults) {
  const app = new EmberApp(defaults, {
    // Add options here
    ...
    autoImport: {
      webpack: {
        // extra webpack configuration goes here
        ...
        plugins: [
          new webpack.ProvidePlugin({
            Buffer: ['buffer', 'Buffer'],
          }),
        ],
        resolve: {
          fallback: {
            ...
            buffer: require.resolve('buffer/'),
          },
        },
      },
    },
  });

  return app.toTree();

};

Now, build again, and we should see the API documentation in the browser.

An image showing the API documentation in the browser.

 

Conclusion

We have successfully integrated swagger-ui using Webpack 5 and Ember Js. For more configuration and customization, please check out their documentation on GitHub.

 

ShareTweetSend
Previous Post

Meet Ukraine’s “cook from the hell of war” mending spirits with a social media blend of cuisine and conflict

Next Post

‘Militarized’ Cybertrucks are coming—if you can open the doors

Related News

WhatsApp Set to Ditch iCloud and Google Drive Support – But Users Should Brace for Changes
Mobile

WhatsApp Set to Ditch iCloud and Google Drive Support – But Users Should Brace for Changes

November 19, 2026
Understanding the Recent Apple Outage: Causes and Implications for Users
Mobile

Understanding the Recent Apple Outage: Causes and Implications for Users

November 18, 2026
Unlocking Potential: Exploring the FDE Model in Enterprise AI Solutions
Mobile

Unlocking Potential: Exploring the FDE Model in Enterprise AI Solutions

November 14, 2026
Unlocking the Scoop: Upcoming Sale Dates, Price Highlights, and Previous Bargains
Mobile

Unlocking the Scoop: Upcoming Sale Dates, Price Highlights, and Previous Bargains

November 14, 2026
Next Post
‘Militarized’ Cybertrucks are coming—if you can open the doors

'Militarized' Cybertrucks are coming—if you can open the doors

Discussion about this post

Subscribe To Our Newsletters

    Customer Support


    1251 Wilcrest Drive
    Houston, Texas
    77042 USA
    Call-832.795.1420
    e-mail – news@theinsightpost.com

    Subscribe To Our Newsletters

      Categories

      • Africa
      • Africa-East
      • African Sports
      • American Sports
      • Arts
      • Asia
      • Australia
      • Business
      • Business Asia
      • Business- Africa
      • Canada
      • Defense
      • Education
      • Egypt
      • Energy
      • Entertainment
      • Europe
      • European Soccer
      • Finance
      • Germany
      • Ghana
      • Health
      • Insight
      • International
      • Investing
      • Japan
      • Latest Headlines
      • Life & Living
      • Markets
      • Mobile
      • Movies
      • New Zealand
      • Nigeria
      • Politics
      • Scholarships
      • Science
      • South Africa
      • South America
      • Sports
      • Tech
      • Travel
      • Travel-Africa
      • UK
      • USA
      • Weather
      • World
      No Result
      View All Result

      Recent News

      Anthropic Set to Make Market Debut Today Following Historic  Billion IPO

      Anthropic Set to Make Market Debut Today Following Historic $81 Billion IPO

      November 19, 2026
      Discover the Fascinating Secrets of NASA’s Voyager Mission: Test Your Knowledge!

      Discover the Fascinating Secrets of NASA’s Voyager Mission: Test Your Knowledge!

      November 19, 2026
      WNBA Begins Search for New Commissioner as Cathy Engelbert’s Tenure May Extend to 2027

      WNBA Begins Search for New Commissioner as Cathy Engelbert’s Tenure May Extend to 2027

      November 19, 2026
      Six Drainage Enhancement Projects Pending Financial Approval, Says Ahmed Ibrahim

      Six Drainage Enhancement Projects Pending Financial Approval, Says Ahmed Ibrahim

      November 19, 2026
      • Home
      • Advertise With Us
      • About Us
      • Corporate
      • Consumer Rewards
      • Forum
      • Privacy Policy
      • Social Trends

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      Welcome Back!

      Login to your account below

      Forgotten Password?

      Retrieve your password

      Please enter your username or email address to reset your password.

      Log In

      Add New Playlist

      We are using cookies to give you the best experience on our website.

      You can find out more about which cookies we are using or switch them off in .

      No Result
      View All Result
      • Home
      • Insight
      • Blog
      • Business
      • Entertainment
      • Health
      • Politics
      • Shop
        • Gift Shop
        • Value Shop
        • Store
        • Bargain Shop
        • Discount
      • Sports
      • Tech
      • Travel
      • USA
      • Video
      • World
        • Asia
        • Africa
        • South America
        • North America
        • Europe
        • Oceania

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      The Insight Post
      Powered by  GDPR Cookie Compliance
      Privacy Overview

      This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

      Strictly Necessary Cookies

      Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

      Cookie Policy

      More information about our Cookie Policy