Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron runtime issue - [vite]: Rollup failed to resolve import "virtual:i18next-loader" #18

Open
grctest opened this issue Mar 11, 2024 · 2 comments

Comments

@grctest
Copy link

grctest commented Mar 11, 2024

I'm getting this blocking error during build:

error during build:
Error: [vite]: Rollup failed to resolve import "virtual:i18next-loader" from "filepath/src/localization/index.js".This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file:///filepath/node_modules/vite/dist/node/chunks/dep-jvB8WLp9.js:67190:27)
    at onRollupWarning (file:///filepath/node_modules/vite/dist/node/chunks/dep-jvB8WLp9.js:67218:9)
    at onwarn (file:///filepath/node_modules/vite/dist/node/chunks/dep-jvB8WLp9.js:66922:13)
    at file:///filepath/node_modules/rollup/dist/es/shared/node-entry.js:18300:13
    at Object.logger [as onLog] (file:///filepath/node_modules/rollup/dist/es/shared/node-entry.js:19957:9)
    at ModuleLoader.handleInvalidResolvedId (file:///filepath/node_modules/rollup/dist/es/shared/node-entry.js:18901:26)
    at file:///filepath/node_modules/rollup/dist/es/shared/node-entry.js:18859:26

I tried adding the following to my vite config without success:

build: {
    rollupOptions: {
      external: ['virtual:i18next-loader'],
    },
  }

Is there a configuration I'm missing for rollup to support vite virtual modules?

Thanks

@rosskevin
Copy link
Member

I reviewed our archetype app and we do nothing with virtual:i18next-loader to make it work.

To me, it looks like this path actually doesn't exist where rollup (via vite) is looking for it, so you might have a path problem?

@grctest
Copy link
Author

grctest commented Mar 11, 2024

Despite the console error in the dev terminal, the virtual module functions as expected.

I've created a discussion in the Vite repo in case it's an issue to do with virtual modules during vite build

vitejs/vite#16142

I have been working on implementing electron context isolation & disabling render node integration for application security best practices & the error was not breaking the build process prior to these changes, so perhaps that's a factor too?

@rosskevin rosskevin changed the title [vite]: Rollup failed to resolve import "virtual:i18next-loader" Electron runtime issue - [vite]: Rollup failed to resolve import "virtual:i18next-loader" Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants