-
Notifications
You must be signed in to change notification settings - Fork 277
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
father v4 如何覆盖默认babel preset 配置 #567
Comments
// .fatherrc.ts
export default defineConfig({
umd: {
chainWebpack(memo, { webpack }) {
const RULES = ['src', 'jsx-ts-tsx', 'extra-src']
RULES.forEach(rule => {
memo.module.rule(rule).use('babel-loader').tap((options) => {
options.presets[0][1].presetEnv.loose = true;
return options
})
})
return memo
},
},
}) 但是不建议你这么用。 |
如果是打包 esm 呢?有办法么? |
// .fatherrc.ts
import { defineConfig } from 'father';
export default defineConfig({
esm: {
output: 'es',
},
extraBabelPlugins: [
[
require.resolve(
'@umijs/bundler-utils/compiled/babel/plugin-proposal-class-properties',
),
{ loose: true },
],
[
require.resolve(
'@umijs/bundler-utils/compiled/babel/plugin-proposal-private-methods',
),
{
loose: true,
},
],
[
require.resolve(
'@umijs/bundler-utils/compiled/babel/plugin-proposal-private-property-in-object',
),
{
loose: true,
},
],
]
}); 可以暂时这么配置解决 |
后续希望father能暴露一个配置参数 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
想配置@umi/babel-preset-umi的loose为true。
理由:class 继承出现属性重复定义的情况,由于defineProperty重复定义属性会报错,有什么解决办法么。
The text was updated successfully, but these errors were encountered: