-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
开启 module federation 后 在低版本浏览器下报错! #5969
Comments
Since you already find the cause, would you want to send a PR? |
#6002 解决 module federation 1.0 正则 |
确实是的,没走编译,导致里面大量let、箭头函数 |
Related issue in Rsbuild: web-infra-dev/rsbuild#2360 (will be fixed in the next version) For Rspack users, you can add the following Rspack rule to match the virtual modules created by the ModuleFederationPlugin: // rspack.config.js
module.exports = {
module: {
rules: [
{
mimetype: {
or: [
'text/javascript',
'application/node',
'application/javascript'
]
},
use: [
{
loader: 'builtin:swc-loader',
options: {
// some SWC options
}
}
],
},
]
},
} |
for rspack, you can add below configuration to downgrade // rspack.config.js
module: {
rules:[
{
+ mimetype: {
+ or: [
+ 'text/javascript',
+ 'application/node',
+ 'application/javascript'
+ ]
+ },
use: {
loader: 'builtin:swc-loader',
options: {
+ env: {
+ targets: [
+ "> 0.5%",
+ "not dead",
+ "IE 11"
+ ],
},
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true,
},
transform: {
react: {
pragma: 'React.createElement',
pragmaFrag: 'React.Fragment',
throwIfNamespace: true,
development: false,
useBuiltins: false,
},
},
},
},
},
type: 'javascript/auto',
},
{
test: /\.jsx?$/,
use: {
loader: 'builtin:swc-loader',
options: {
+ env: {
+ targets: [
+ "> 0.5%",
+ "not dead",
+ "IE 11"
+ ],
},
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true,
},
transform: {
react: {
pragma: 'React.createElement',
pragmaFrag: 'React.Fragment',
throwIfNamespace: true,
development: false,
useBuiltins: false,
},
},
},
},
},
type: 'javascript/auto',
},
]
}, I recommend you use rsbuild , it will auto apply you targets , no need to config so complex. And the |
Thanks, I prefer to use Rsbuild and I will wait for the next version. |
The text was updated successfully, but these errors were encountered: