Skip to content
New issue

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

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

Already on GitHub? # to your account

@rollup/plugin-inject incompatible despite being in the list #12916

Closed
7 tasks done
jaskp opened this issue Apr 19, 2023 · 2 comments · Fixed by #13662
Closed
7 tasks done

@rollup/plugin-inject incompatible despite being in the list #12916

jaskp opened this issue Apr 19, 2023 · 2 comments · Fixed by #13662
Labels
p2-nice-to-have Not breaking anything but nice to have (priority) rollup plugin compat

Comments

@jaskp
Copy link

jaskp commented Apr 19, 2023

Describe the bug

The plugin @rollup/plugin-inject is in the list of compatible plugins linked in the docs but it raises warnings.

Using the vanilla JS template, the warnings are:

19:04:27 [vite] warning: rollup-plugin-inject: failed to parse /home/projects/vite-rollup-plugin-inject-mre-z1z9rb/style.css. Consider restricting the plugin to particular files via options.include
  Plugin: inject
  File: /home/projects/vite-rollup-plugin-inject-mre-z1z9rb/style.css
Sourcemap for "/home/projects/vite-rollup-plugin-inject-mre-z1z9rb/node_modules/vite/dist/client/client.mjs" points to missing source files
Sourcemap for "/home/projects/vite-rollup-plugin-inject-mre-z1z9rb/node_modules/vite/dist/client/env.mjs" points to missing source files

If the plugin config is set to enforce: 'post', then the sourcemap warnings remain:

Sourcemap for "/home/projects/vite-rollup-plugin-inject-mre-z1z9rb/node_modules/vite/dist/client/client.mjs" points to missing source files
Sourcemap for "/home/projects/vite-rollup-plugin-inject-mre-z1z9rb/node_modules/vite/dist/client/env.mjs" points to missing source files

Note: The warning seems to disappear sometimes after editing main.js in the provided stackblitz project, so try to refresh the page after making changes.

Reproduction

https://stackblitz.com/edit/vite-rollup-plugin-inject-mre-z1z9rb?file=main.js

Steps to reproduce

npm install && npm run dev

System Info

See stackblitz.

Used Package Manager

npm

Logs

No response

Validations

@stackblitz
Copy link

stackblitz bot commented Apr 19, 2023

@bluwy
Copy link
Member

bluwy commented Apr 27, 2023

You'd need enforce: 'post' or pass the include: '**/*.js' option to work. You could send a PR to https://github.com/patak-dev/vite-rollup-plugins to update it. The sourcemap warning could be something we can fix on our side though, but it should be harmless in practice and doesn't make the plugin incompatible.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
p2-nice-to-have Not breaking anything but nice to have (priority) rollup plugin compat
Projects
None yet
2 participants