Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hello there,

we migrated our Rails-App to vitejs and everything seems to work nice in development.

Deploying it to production, it's yielding the following error:
Uncaught TypeError: Failed to resolve module specifier "@hotwired/stimulus". Relative references must start with either "/", "./", or "../".

Looking at the precompiled source it seems that the path to node_modules is not beeing inserted:
/vite/assets/application-fxJWKlir.js

import"./application-vJJ2Zb4R.js";import"@hotwired/stimulus";

Do i have to add node_modules to vite config?
In https://vite-ruby.netlify.app/guide/deployment.html#disabling-node-modules-installation-in-assets-precompile it says that node_modules will be auto-installed by assets:precompile..

package.json

{
  "name": "app",
  "private": true,
  "type": "module",
  "dependencies": {
    "@hotwired/stimulus": "^3.2.2",
    "@hotwired/turbo-rails": "^8.0.16",
    "@rails/request.js": "^0.0.12",
    "@stimulus-components/dialog": "^1.0.1",
    "jquery": "^3.3.1",
    "stimulus-vite-helpers": "^3.1.0",
    "vite-plugin-rails": "^0.5.0"
  },
  "devDependencies": {
    "sass-embedded": "^1.89.2",
    "vite": "^5.4.19",
    "vite-plugin-resolve": "^2.5.2"
  }
}

Thank you for any hint!

Best wishes, T.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.