Giter Club home page Giter Club logo

Comments (8)

caoxiemeihao avatar caoxiemeihao commented on June 2, 2024 2

v1.3.0 support 👉 node_modules

from vite-plugin-dynamic-import.

caoxiemeihao avatar caoxiemeihao commented on June 2, 2024 1

I'm facing the same problem when expecting vite-plugin-dynamic-import will work on some imported node_modules libs.

For instance, to reproduce :

create a basic vite project
install @ionic/core : npm install @ionic/core
Import it in your index.ts file :

Hey 👋 @fcamblor it works to me. @v1.3.0
image

dynamicImport({
  filter(id) {
    // `node_modules` is exclude by default, so we need to include it explicitly
    if (id.includes('node_modules/@ionic')) {
      return true
    }
  },
}),

from vite-plugin-dynamic-import.

fcamblor avatar fcamblor commented on June 2, 2024 1

@caoxiemeihao, I've seen your README update from yesterday but didn't got a chance to try it out before you did.

Thanks a lot for a that fast workaround ;-)

from vite-plugin-dynamic-import.

gabalicious avatar gabalicious commented on June 2, 2024

I too am having issues trying to dynamically import from node_modules folder

from vite-plugin-dynamic-import.

caoxiemeihao avatar caoxiemeihao commented on June 2, 2024

Who can provide a minimal reproduction repo?

from vite-plugin-dynamic-import.

Miofly avatar Miofly commented on June 2, 2024

https://github.com/Miofly/vue-admin-plus
image

image
image

plugin is in vite-common-config

image

from vite-plugin-dynamic-import.

fcamblor avatar fcamblor commented on June 2, 2024

I'm facing the same problem when expecting vite-plugin-dynamic-import will work on some imported node_modules libs.

For instance, to reproduce :

  • create a basic vite project
  • install @ionic/core : npm install @ionic/core
  • Import it in your index.ts file :
import { defineCustomElements as defineIonicCustomElements } from '@ionic/core/loader';

....

defineIonicCustomElements();
  • Include a simple <ion-button>hello</ion-button> in your app
  • You will see an error in the console :

image

- This error is due to the fact that a dynamic import is performed in `node_modules/@ionic/core/dist/esm-es5/index-be218d70.js` file :

image

... and this file is not handled properly by vite (I assume this is because it is outside of my project's scope, because located in node_modules)

from vite-plugin-dynamic-import.

Miofly avatar Miofly commented on June 2, 2024

@caoxiemeihao

i use latest version,Although the function is not affected, the following error will occur when starting
image

is seem to import type error

repo link:https://github.com/Miofly/vue-admin-plus

from vite-plugin-dynamic-import.

Related Issues (20)

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.