Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝add the configuration of webpack5 #2652

Merged
merged 7 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
📝add the configuration of webpack5
  • Loading branch information
gongshun committed Sep 3, 2023
commit c3f47065a99e6418072df90914bee22114e835b7
14 changes: 14 additions & 0 deletions docs/guide/getting-started.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ qiankun 基于 single-spa,所以你可以在[这里](https://single-spa.js.org

#### webpack:

webpack v5 版本:
```js
const packageName = require('./package.json').name;

module.exports = {
output: {
library: `${packageName}-[name]`,
libraryTarget: 'umd',
chunkLoadingGlobal: `webpackJsonp_${packageName}`,
},
};
```

webpack v4 版本:
```js
const packageName = require('./package.json').name;

Expand Down
5 changes: 3 additions & 2 deletions docs/guide/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ It's important, When mount a sub-application through ReactDOM.render, need to en
webpack: (config) => {
config.output.library = `${name}-[name]`;
config.output.libraryTarget = 'umd';
// If you are using webpack 5, please replace jsonpFunction with chunkLoadingGlobal
config.output.jsonpFunction = `webpackJsonp_${name}`;
config.output.globalObject = 'window';

Expand Down Expand Up @@ -240,7 +241,7 @@ Take the `vue 2.x` project generated by `vue-cli 3+` as an example, and add it a
output: {
library: `${name}-[name]`,
libraryTarget: 'umd', // bundle the micro app into umd library format
jsonpFunction: `webpackJsonp_${name}`,
jsonpFunction: `webpackJsonp_${name}`, // // If you are using webpack 5, please replace jsonpFunction with chunkLoadingGlobal
},
},
};
Expand Down Expand Up @@ -331,7 +332,7 @@ Take the `angular 9` project generated by `Angular-cli 9` as an example, other v
output: {
library: `${appName}-[name]`,
libraryTarget: 'umd',
jsonpFunction: `webpackJsonp_${appName}`,
jsonpFunction: `webpackJsonp_${appName}`, // // If you are using webpack 5, please replace jsonpFunction with chunkLoadingGlobal
},
};
```
Expand Down
7 changes: 4 additions & 3 deletions docs/guide/tutorial.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ start();
webpack: (config) => {
config.output.library = `${name}-[name]`;
config.output.libraryTarget = 'umd';
config.output.jsonpFunction = `webpackJsonp_${name}`;
// webpack 5 需要把 jsonpFunction 替换成 chunkLoadingGlobal
config.output.jsonpFunction = `webpackJsonp_${name}`;
config.output.globalObject = 'window';

return config;
Expand Down Expand Up @@ -240,7 +241,7 @@ start();
output: {
library: `${name}-[name]`,
libraryTarget: 'umd', // 把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${name}`,
jsonpFunction: `webpackJsonp_${name}`, // webpack 5 需要把 jsonpFunction 替换成 chunkLoadingGlobal
},
},
};
Expand Down Expand Up @@ -331,7 +332,7 @@ start();
output: {
library: `${appName}-[name]`,
libraryTarget: 'umd',
jsonpFunction: `webpackJsonp_${appName}`,
jsonpFunction: `webpackJsonp_${appName}`, // webpack 5 需要把 jsonpFunction 替换成 chunkLoadingGlobal
},
};
```
Expand Down
Loading