We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
After I run npm run build, I got this error.
npm run build
This is my vite.config.ts:
import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import vitePluginRequire from 'vite-plugin-require'; import ViteRequireContext from '@originjs/vite-plugin-require-context'; import federation from '@originjs/vite-plugin-federation'; import topLevelAwait from 'vite-plugin-top-level-await'; import { viteCommonjs, esbuildCommonjs } from '@originjs/vite-plugin-commonjs'; export default defineConfig(({ mode }) => { return { base: '/', plugins: [ react(), vitePluginRequire(), ViteRequireContext(), federation({ name: 'bohrium', remotes: { dpMol: { external: 'https://cdn.xxxx/remoteEntry.js', externalType: 'url', format: 'var', }, }, filename: 'remoteEntry.[contenthash:8].js', exposes: { './A': '../src/shared/hooks/a', './B': '../src/shared/components/b', }, shared: ['react', 'react-dom'], }), topLevelAwait({ promiseExportName: '__tla', promiseImportName: i => `__tla_${i}`, }), viteCommonjs(), ], optimizeDeps: { esbuildOptions: { target: ['es2015', 'safari11'], plugins: [esbuildCommonjs()], }, exclude: ['jquery'], }, build: { target: ['es2015', 'safari11'], outDir: './build', rollupOptions: { external: ['react', 'react-dom', 'jquery'], output: { globals: { react: 'React', 'react-dom': 'ReactDOM', jquery: ['jQuery', '$'], }, }, }, sourcemap: true, }, }; });
This is the error log:
Uncaught (in promise) TypeError: Failed to construct 'URL': Invalid URL at __federation_fn_import-b9cca9f6.js:1:5743
The error occurs in new URL(xxx, K.url) because K is an empty object.
new URL(xxx, K.url)
This is the code in __federation_fn_import-b9cca9f6.js, the complete document is in the attachment:
const K = {}; const q = { react: { get: ()=>()=>I(new URL("__federation_shared_react-2fa0e958.js",K.url).href), import: !0 }, [__federation_fn_import-b9cca9f6.js.zip](https://github.com/originjs/vite-plugin-federation/files/14902568/__federation_fn_import-b9cca9f6.js.zip) "react-dom": { get: ()=>()=>I(new URL("__federation_shared_react-dom-661945d7.js",K.url).href), import: !0 } }
The text was updated successfully, but these errors were encountered:
你这个问题解决了么?
Sorry, something went wrong.
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Have you solved this problem?
No branches or pull requests
Versions
Reproduction
After I run
npm run build
, I got this error.This is my vite.config.ts:
This is the error log:
What is actually happening?
The error occurs in
new URL(xxx, K.url)
because K is an empty object.This is the code in __federation_fn_import-b9cca9f6.js, the complete document is in the attachment:
The text was updated successfully, but these errors were encountered: