geocld / vite-plugin-importus Goto Github PK
View Code? Open in Web Editor NEWModularly import plugin, compatible with antd, lodash, material-ui and so on.
License: MIT License
Modularly import plugin, compatible with antd, lodash, material-ui and so on.
License: MIT License
I get this error
Sourcemap is likely to be incorrect: a plugin (vite-plugin-importus) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
And my build sizes are the exact same as without this plugin :/
// vitePluginImp({
// libList: [
// {
// libName: '@xxx/antd',
// libDirectory: 'es',
// style: (name) => `@xxx/antd/es/${name}/style/css.js`,
// },
// ],
// }),
// vitePluginImporter({
// libraryName: '@xxx/antd',
// libraryDirectory: 'es',
// style: (name) => `${name}/style/css.js`,
// }),
vitePluginImportus([
{
libraryName: '@xxx/antd',
libraryDirectory: 'es',
style: 'css',
},
]),
Another two plugin both works, but this plugin doesn't work, it doesn't load css
Version:
Hello, author
My element-ui is version 2.13.2,vite version is 3.1.0,When packaged with vite, the element-ui el-input component is invalidated,And missing styles for some components,For example, the el-main component style is missing,There is nothing wrong with the development environment,This problem occurs after packing In a production environment。
This is my configuration in vite.config.js
import vitePluginImportus from 'vite-plugin-importus'
plugins: [
vitePluginImportus([
{
libraryName: 'element-ui',
styleLibraryDirectory: "lib/theme-chalk",
customName: (name, file) => {
return element-ui/lib/${name}
;
},
customStyleName: (name, file) => {
return element-ui/lib/theme-chalk/${name}.css
;
}
}
]
)
],
This is the configuration in my package.json
{
"name": "my-project",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --mode production",
"build:test": "vite build --mode test",
"preview": "vite preview"
},
"resolutions": {
"bin-wrapper": "npm:bin-wrapper-china"
},
"devDependencies": {
"@vitejs/plugin-legacy": "^2.3.0",
"autoprefixer": "^10.4.13",
"rollup-plugin-visualizer": "^5.8.3",
"sass": "^1.55.0",
"vite": "^3.1.0",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-importus": "^1.0.4",
"vite-plugin-vue2": "^2.0.2"
},
"dependencies": {
"axios": "^1.1.3",
"element-ui": "^2.13.2",
"js-cookie": "^3.0.1",
"lodash-es": "^4.17.21",
"vue": "2.5.2",
"vue-router": "3.0.1",
"vue-template-compiler": "2.5.2",
"vuex": "3.0.1"
}
}
This is the configuration in my main.js
// ...Introduction of other components
import {Input} from 'element-ui'
Vue.use(Input);
Looking forward to your reply at last. Thank you!
Thanks your work. It seems this package not support .vue
file, it is by design?
if (["js", "jsx", "ts", "tsx", "vue"].indexOf(ext) > -1) {
code = await transform_default(code, importOptions);
}
Or we can add a extensions
option to enable customize
Sourcemap is likely to be incorrect: a plugin (vite-plugin-importus) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
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.