umijs / babel-plugin-import

Modularly import plugin for babel.
3.16k stars 404 forks source link

["import", { "libraryName": "antd", "style": (name) => `${name}/style/2x` }] 你确定这样写不报错吗。 报这样的错误(name) => 这个不行 #497

Open parlay96 opened 4 years ago

parlay96 commented 4 years ago

["import", { "libraryName": "antd", "style": (name) => ${name}/style/2x }] 你确定这样写不报错吗。 报这样的错误(name) => 这个不行

Reda011 commented 3 years ago

提示:Value expectedjsonc(516) 是不是.babelrc只支持JSON内容?

Tanglongwen commented 2 years ago

.babelrc is a json, can not write function. you can config the babel-loader by webpack.config.js, like module: { rules: [ { test: /\.js$/, loader: "babel-loader", exclude: /node_modules/, options: { plugins: [ ["import", { "libraryName": "xxx", "libraryDirectory": "lib", "camel2DashComponentName": false, "style": (name) =>${name}/style/2x }] ] } } ] }