Skip to content

Commit

Permalink
chore: update usage
Browse files Browse the repository at this point in the history
  • Loading branch information
2heal1 committed Jan 6, 2025
1 parent 6709d80 commit f07aee4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/router-demo/router-remote4-2004/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineConfig({
},
shared: ['react', 'react-dom'],
// getPublicPath: `return 'http://localhost:2004/'`,
getPublicPath: `function(){return 'http://localhost:2004/'}`,
getPublicPath: `function(originalPublicPath){console.log(originalPublicPath);__webpack_require__.p = 'http://localhost:2004/'}`,
}),
],
});
1 change: 0 additions & 1 deletion packages/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"@module-federation/sdk": "workspace:*"
},
"devDependencies": {
"@types/btoa": "1.2.5",
"@rspack/core": "^1.0.2"
},
"exports": {
Expand Down
5 changes: 2 additions & 3 deletions packages/rspack/src/RemoteEntryPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Compiler, RspackPluginInstance } from '@rspack/core';
// @ts-ignore
import pBtoa from 'btoa';

const charMap: Record<string, string> = {
Expand Down Expand Up @@ -39,9 +40,7 @@ export class RemoteEntryPlugin implements RspackPluginInstance {
compiler.webpack.RuntimeGlobals.publicPath
} = new Function(${JSON.stringify(sanitizedPublicPath)})()`;

Check warning

Code scanning / CodeQL

Improper code sanitization Medium

Code construction depends on an
improperly sanitized value
.
} else {
code = `${
compiler.webpack.RuntimeGlobals.publicPath
} = (${sanitizedPublicPath})()`;
code = `(${sanitizedPublicPath}(${compiler.webpack.RuntimeGlobals.publicPath}))`;
}
const base64Code = pBtoa(code);
const dataUrl = `data:text/javascript;base64,${base64Code}`;
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f07aee4

Please sign in to comment.