Skip to content

Commit

Permalink
fix(preset): dynamic import maybe blocked by adblock
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Nov 8, 2020
1 parent 3090909 commit a52d9ea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/preset-dumi/src/plugins/features/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export default (api: IApi) => {
});
demoComponent = `() => React.createElement(dynamic({
loader: async function() {
const { default: demos } = await import(/* webpackChunkName: "demos_${componentName}" */'./${componentName}');
const { default: demos } = await import(/* webpackChunkName: "demos_${[...componentName]
// reverse component name to avoid some special component (such as Advertisement) be blocked by ADBlock when dynamic loading
.reverse()
.join('')}" */'./${componentName}');
return demos['${uuid}'].component;
},
Expand Down

0 comments on commit a52d9ea

Please sign in to comment.