No name was provided for external module/Failed to resolve module specifier #12482
-
For some reason, Rollup refuses to recognize my global external dependencies. From my export default defineConfig({
build: {
rollupOptions: {
external: ['radash', '@leeoniya/ufuzzy'],
output: {
globals: {
radash: '_',
'@leeoniya/ufuzzy': 'Fuzzy',
},
},
},
},
[...] From my Vite build:
I've also tried using vite-plugin-externals with the same result. The consequences is that my builds are broken and throw a console error:
Is this a bug or am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ok, I figured it out. The two issues, the first being the warnings about unnamed modules, and the second about not being able to 'resolve module specifier' are actually not really related though they appear to be as they both deal with the same imports. The issue was that these are Web Workers I was importing using the
const workerUrl = new URL('/workers/inventorySearch.js', import.meta.url).href;
worker = new Worker(workerUrl, { type: 'module' }); |
Beta Was this translation helpful? Give feedback.
Ok, I figured it out.
The two issues, the first being the warnings about unnamed modules, and the second about not being able to 'resolve module specifier' are actually not really related though they appear to be as they both deal with the same imports.
The issue was that these are Web Workers I was importing using the
?worker
method and not theimport.meta.url
method. As such, I was improperly importing dependencies for those workers from my local project thinking incorrectly that they'd be imported. The fix was:static
folder.unpkg.com
with a standardimport
call (notimportScripts
) for my workers'…