Share Loader

Share modules between webpack applications
Alternatives To Share Loader
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Storybook81,12626,4879 hours ago1,044December 02, 20231,789mitTypeScript
Storybook is a frontend workshop for building UI components and pages in isolation. Made for UI development, testing, and documentation.
React Boilerplate29,281238 months ago1May 11, 2014116mitJavaScript
:fire: A highly scalable, offline-first foundation with the best developer experience and a focus on performance and best practices.
Fe Interview24,218
a day ago5,565mitJavaScript
前端面试每日 3+1,以面试题来驱动学习,提倡每日学习与思考,每天进步一点!每天早上5点纯手工发布面试题(死磕自己,愉悦大家),6000+道前端面试题全面覆盖,HTML/CSS/JavaScript/Vue/React/Nodejs/TypeScript/ECMAScritpt/Webpack/Jquery/小程序/软技能……
React Redux Links22,290
a month ago33
Curated tutorial and resource links I've collected on React, Redux, ES6, and more
Electron React Boilerplate22,098513 days ago3April 28, 2016106mitTypeScript
A Foundation for Scalable Cross-Platform Apps
Generator Jhipster21,0014,66621012 hours ago273November 02, 2023197apache-2.0TypeScript
JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
Js Stack From Scratch19,3962a year ago1January 19, 201748mitJavaScript
🛠️⚡ Step-by-step tutorial to build a modern JavaScript stack.
Ice17,6901,5775 days ago90August 26, 2022304mitTypeScript
🚀 ice.js: The Progressive App Framework Based On React(基于 React 的渐进式应用框架)
React Loadable16,5803,2501,204a year ago30August 09, 201838mitJavaScript
:hourglass_flowing_sand: A higher order component for loading components with promises.
Front End Guide14,90326 months ago1June 22, 201725mitJavaScript
📚 Study guide and introduction to the modern front end stack.
Alternatives To Share Loader
Select To Compare


Alternative Project Comparisons
Readme

npm npm MIT licensed

Share Loader

The share loader allows you to share modules between webpack builds via a global namespace

Install

npm i share-loader --save-dev

Or

yarn add share-loader --save-dev

Usage

webpack config of exposing app

module: {
  rules: [{
          test: /\.js?$/,
          use: [{
            loader: 'share-loader',
            options: {
              modules: [/@angular/, /@uirouter\/angular/],
              exclude: [/@angular\/material/],
              namespace: 'some-name-space'
            }
          }]
        }]
}

webpack config of consumer apps

const {Externals} = require('./share-loader');

externals: [
  Externals({
    namespace: 'some-name-space',
    modules: [/@angular/, /@uirouter\/angular/]
  })
],
output: {
  library: 'some-name-space',
  libraryTarget: 'umd'
}


Example

1. In the root folder, run npm bootstrap
2. Run npm run build:prod in the ext-app-1 root
3. Host the ext1.js file from ext-app-1 project in some localhost server
4. Change the <%path-to-server-host%> in the shell project app.state.ts
5. Run npm run serve:dev in the shell project root



Example-cli
1. In the root folder, run npm bootstrap
2. In "shell app" folder run npm run start:prod
3. In the "ext-app1" folder run npm run start:ext:prod
4. For AOT run npm serve --prod in "shell-app" and npm run serve:ext:prod in "ext-app1"
5. You can also run ext-app1 in standalone mode with ng serve
Popular Webpack Projects
Popular Reactjs Projects
Popular Build Tools Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Typescript
Reactjs
Vuejs
Angular
Webpack Plugin
Ember
Webpack Loader