lin-xi / babel-plugin-import-fix Goto Github PK
View Code? Open in Web Editor NEWalter import module to certain module file path for smaller bundle and better performance
alter import module to certain module file path for smaller bundle and better performance
假设.babelrc
文件是这样:
{
"presets": [
["env", { "modules": false }]
],
"plugins": [["import-fix",
[{
"libraryName": "xcui",
"libraryPath": "xcui/lib/${name}.js",
"namePolicy": "dash",
"cssPath": ["xcui/lib/less/components/common.less", "xcui/lib/less/components/${name}.less"]
}]
]]
}
实际上还是加载lib/module-config
中的配置,此配置没有生效。
应该要用户配置优先。
麻烦溪总修复~
会出现错误
Error: This API has been removed. If you're looking for this functionality in Babel 7, you should import the '@babel/helper-module-imports' module and use the functions exposed from that module, such as 'addNamed' or 'addDefault'.
https://github.com/lin-xi/babel-plugin-import-fix/blob/master/lib/index.js#L126
import Plugin from './Plugin'
./Plugin 应该为小写
导致编译错误
{
"presets": [["env", { "modules": false }], "react"],
"plugins": [
"babel-plugin-transform-decorators-legacy",
"transform-object-rest-spread",
"transform-class-properties",
["import-fix", {
"libraryName": "antd",
"libraryPath": "antd/lib/${name}/index.js",
"namePolicy": "dash",
"cssPath": ""
}]
]
}
我将 cssPath
置空,但是还是会按照默认配置进行读取,我看之前有人提了 issue,但还是存在这个问题?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.