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
The suggested code import.meta.globEager('./**/*_channel.js') raises the following syntax error:
Uncaught SyntaxError: unexpected token: ':'
I don't think Vite supports using import.meta.globEager without saving it in a variable, as the code above produces (with an asd_channel.js inside the entrypoints folder):
{"./asd_channel.js": __glob_0_0,}
which is a syntax error without a variable declaration (i.e. const something = ) before.
Changing the code to something like const _ = import.meta.globEager('./**/*_channel.js') makes it work.
Reproduction 🐞
Please provide a link to a repo that can reproduce the problem you ran into.
I will if needed, but the error happens just uncommenting the line after installing vite_rails, so the repo may be useless.
Run DEBUG=vite-plugin-ruby:* bin/vite dev or DEBUG=vite-plugin-ruby:* bin/vite build and provide the output:
> DEBUG=vite-plugin-ruby:* bin/vite build
Building with Vite ⚡️
vite v2.7.1 building for production...
transforming...
✓ 2 modules transformed.
Unexpected token
file: /home/maurizio/Sviluppo/rails-7/rails-7-demo-vite-2/app/frontend/entrypoints/application.js:24:42
22: //
23: // // Import all channels.
24: import.meta.globEager('./**/*_channel.js')
^
25: //
26: // Turbolinks.start()
error during build:
Error: Unexpected token
at error (/home/maurizio/Sviluppo/rails-7/rails-7-demo-vite-2/node_modules/rollup/dist/shared/rollup.js:158:30)
at Module.error (/home/maurizio/Sviluppo/rails-7/rails-7-demo-vite-2/node_modules/rollup/dist/shared/rollup.js:12354:16)
at Module.tryParse (/home/maurizio/Sviluppo/rails-7/rails-7-demo-vite-2/node_modules/rollup/dist/shared/rollup.js:12757:25)
at Module.setSource (/home/maurizio/Sviluppo/rails-7/rails-7-demo-vite-2/node_modules/rollup/dist/shared/rollup.js:12660:24)
at ModuleLoader.addModuleSource (/home/maurizio/Sviluppo/rails-7/rails-7-demo-vite-2/node_modules/rollup/dist/shared/rollup.js:22138:20)
Build with Vite failed! ❌
Screenshots 📷
The text was updated successfully, but these errors were encountered:
FixesElMassimo#154. It adds variable declaration to `import.meta.globEager`, as it seems that `Vite.js` doesn't support `import.meta.globEager` calls without saving them somewhere.
bundle update vite_ruby
.Description 📖
The suggested code
import.meta.globEager('./**/*_channel.js')
raises the following syntax error:I don't think Vite supports using
import.meta.globEager
without saving it in a variable, as the code above produces (with anasd_channel.js
inside theentrypoints
folder):which is a syntax error without a variable declaration (i.e.
const something =
) before.Changing the code to something like
const _ = import.meta.globEager('./**/*_channel.js')
makes it work.Reproduction 🐞
Please provide a link to a repo that can reproduce the problem you ran into.
I will if needed, but the error happens just uncommenting the line after installing
vite_rails
, so the repo may be useless.Vite Ruby Info
Output
Run
DEBUG=vite-plugin-ruby:* bin/vite dev
orDEBUG=vite-plugin-ruby:* bin/vite build
and provide the output:Screenshots 📷
The text was updated successfully, but these errors were encountered: