You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.
Describe the bug
When using import('clipboard') to dynamically load the Clipboard.js library, the resulting module looks like the following, with two default fields nested into each other:
in contrast when loading the library with a regular import ClipboardJS from 'clipboard' I directly get the constructor function or similarly with import * as clipboard from 'clipboard' the following object with only a single default field:
I would expect to get the same module shape also via import('clipboard'), which is also what Webpack produces.
Reproduction
Use the vanilla vite template, install clipboard and add the following code snippet to main.js
import('clipboard').then(({default: ClipboardJS})=>{
new ClipboardJS('h1');
});
This fails with
Uncaught (in promise) TypeError: ClipboardJS is not a constructor
at main.js:8
System Info
vite version: 2.0.0-beta.60
Operating System: MacOS
Node version: 14.15
Package manager (npm/yarn/pnpm) and version: yarn
The text was updated successfully, but these errors were encountered:
Describe the bug
When using
import('clipboard')
to dynamically load the Clipboard.js library, the resulting module looks like the following, with two default fields nested into each other:in contrast when loading the library with a regular
import ClipboardJS from 'clipboard'
I directly get the constructor function or similarly withimport * as clipboard from 'clipboard'
the following object with only a single default field:I would expect to get the same module shape also via
import('clipboard')
, which is also what Webpack produces.Reproduction
Use the vanilla vite template, install clipboard and add the following code snippet to
main.js
This fails with
System Info
vite
version: 2.0.0-beta.60The text was updated successfully, but these errors were encountered: