Comments (6)
I'm not sure if Webpack is supported for a Rails engine, not from what I can see in Rails 5. But yeah, I can take a look and see if it can be done.
from wallaby-rails.
From my understanding there's no way to add node dependencies through a gem so you can't use it through an engine the same way sprockets is used. You can still do it, but the the node dependency needs to be added separately.
For example, let's say you have a wallaby-webpacker
gem which is designed to work with webpacker instead of sprockets. To install it you'd do:
gem install wallaby-webpacker
yarn add wallaby-rails # or whatever you name the module
Then they need to generate a pack file:
// in app/javascript/packs/wallaby.js
import 'wallaby-rails'
Then the wallaby layout needs to link to that pack:
<%= stylesheet_pack_tag "wallaby", media: "all" %>
<%= javascript_pack_tag "wallaby" %>
Perhaps supply a generator to do these steps.
Why do we want this? Currently Wallaby depends on these gems: bootstrap, bootstrap4-datetime-picker-rails, jquery-rails, momentjs-rails, sass-rails, font-awesome-sass. These are all front-end dependencies and our app is using the node versions. This duplicates the dependencies of our app for all of these assets, and every deploy generates two copies of these dependencies: one through sprockets and another through webpack.
In theory we could remove sprockets entirely if wallaby didn't use it.
from wallaby-rails.
Yeah, I totally understand why everyone wants it these days. Let me do some experiments and see.
from wallaby-rails.
This is some extra information about how to include assets in engines:
https://github.com/rails/webpacker/blob/master/docs/engines.md
from wallaby-rails.
@leomao10 try this: rails/webpacker#348 (comment)
from wallaby-rails.
Since Webpacker is retired, I suggest not doing what I recommended above. I'm closing this issue.
from wallaby-rails.
Related Issues (20)
- Unable to perform "or" search with nil HOT 4
- Error: primary::SchemaMigration is not a valid Class name. HOT 5
- Conflict with closure_tree HOT 9
- Reloading slow in development HOT 7
- Demo website sign in is not working HOT 10
- Preload `ActiveRecord::SchemaMigration` before ActiveRecord mode starts finding all models HOT 1
- Support ActionText HOT 1
- Specify Bootstrap v4 HOT 4
- Singleton can't be dumped error in Rails 7.0.1 HOT 17
- Missing translation in 6.1.4 HOT 2
- Object is not decorated error in Rails 7.0.3 HOT 5
- Ruby 3.0+ support HOT 5
- Decorator not set in Rails 7.1.2 HOT 18
- Unknown enum attribute HOT 15
- Mono Repo HOT 11
- Application controller config not inherited HOT 4
- Large Text in 7 Beta 2 HOT 3
- Exception ignored when loading decorator HOT 14
- Slow Loading in Wallaby 7.0 HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wallaby-rails.