Git Product home page Git Product logo

vite-plugin-importus's People

Contributors

geocld avatar iceprosurface avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

iceprosurface

vite-plugin-importus's Issues

Doesn't seem to have an effect if source maps were enabled

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 :/

doesn't work for @xxx/antd

// 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:

image

Missing element-ui component packaging

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。

  1. 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;
    }
    }
    ]
    )
    ],

  2. 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"
    }
    }

  3. 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!

Support .vue file? or add a extension option

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.