Rails n'est pas défini javascript
I am able to access the Rails object by adding this to my pack:
import Rails from "@rails/ujs";
window.Rails = Rails;
Zagham Abbas
I am able to access the Rails object by adding this to my pack:
import Rails from "@rails/ujs";
window.Rails = Rails;
// config/webpack/environment.js
const { environment } = require('@rails/webpacker')
const webpack = require('webpack')
environment.plugins.prepend('Provide',
new webpack.ProvidePlugin({
Rails: ['@rails/ujs']
})
)
module.exports = environment