Comments (6)
No plans for that at the moment. But if you want to work on it, feel free to open a PR if you get something together!
from webpacker.
Sorry but probably no, per the FAQ of ExecJS: https://github.com/sstephenson/execjs#faq
Why can't I use CommonJS require() inside ExecJS?
ExecJS provides a lowest common denominator interface to any JavaScript runtime. Use ExecJS when it doesn't matter which JavaScript interpreter your code runs in. If you want to access the Node API, you should check another library like commonjs.rb designed to provide a consistent interface.
We need a full Node environment to run Webpack and ExecJS can't provide that.
from webpacker.
@guilleiguaran so could https://github.com/cowboyd/commonjs.rb theoretically provide the required support? I'm asking that because webpack's minimal node version is 0.5
, so I'm guessing libv8 could provide whatever API's they are using.
While most of the time we would use nodejs, having an embedded executor could help into more restricted environments like heroku, or to build smaller docker images.
from webpacker.
@brodock Yes, I think should be possible to use commonjs.rb (if the version of v8 provided by therubyracer is good enough) to do it.
You can check https://github.com/cowboyd/less.rb that is based in commonjs.rb for reference.
from webpacker.
@brodock I've been lookig into this, I haven't been able to get this working, but I know webpack lets you expose libraries as globals, maybe these would work with ExecJS? I know react-rails
takes advantage of global variables to do server-side rendering, and I have read of people getting it to work with browserify
by exposing globals, so maybe you can create a pack that exposes some globals like this and load those into ExecJS? Please do let us know if you get this somewhere
from webpacker.
I will share a few experiments I've made. Because I don't understand well how the dependency system in JS works or is supposed to work, I think I'm missing something important:
https://gist.github.com/brodock/f8862a94e3494d2cc20689b4f8bd6dfa
from webpacker.
Related Issues (20)
- Webpacker 6 Disable Babel HOT 1
- Webpacker compilation takes more than 1.5 hours HOT 11
- How do I allow a package in node_modules to be processed by babel? HOT 1
- Remove addition of node_modules to Rails.application.config.assets.paths HOT 1
- V6 Status HOT 3
- Raise an error when javascript_pack_tag or stylesheet_pack_tag are called more than once HOT 1
- Regular Expression Denial of Service in postcss HOT 2
- Intermittent Webpacker.dev_server.running? behavior HOT 2
- Host for assets from a webpacker configuration using custom domains not being resolved HOT 2
- Cherry-pick "Nothing to do" logging update onto `5.x` HOT 1
- Rails 6 WebPacker is not calling JQuery inside views HOT 1
- Security Vulnerability in [email protected] HOT 2
- currently no loaders are configured to process this file HOT 1
- Incompatibility with Ruby 3.2.0 HOT 2
- Confusing gem description on RubyGems HOT 1
- Npm package for 5.4.4 was not released HOT 2
- class variable @@local_levels of ActiveSupport::Logger is overtaken by Logger HOT 2
- Trying to deploy but assets assets:precompile fail
- Security Vulnerability for postcss
- Postcss Security Vulnerability
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 webpacker.