rails-webpacker | Multiple examples using react | Application Framework library
kandi X-RAY | rails-webpacker Summary
kandi X-RAY | rails-webpacker Summary
Demo app that showcases Rails on webpack and yarn using Webpacker gem (default setup in upcoming Rails 5.1).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rails-webpacker
rails-webpacker Key Features
rails-webpacker Examples and Code Snippets
Community Discussions
Trending Discussions on rails-webpacker
QUESTION
In this Webpacker config and Webpacker setup there's a common setup:
...ANSWER
Answered 2020-Jun-13 at 17:19module.exports just tells what should be exported from this file to be reused in others.
If I just read at what does the 3 lines of code you shared,
const envConfig = module.exports = environment
far left-hand side "environment" is assigned to "module.exports" left-hand side "module.exports" to right-hand side "envConfig"
const aliasConfig = module.exports = {...}
"module.exports" is now assigned another object and lost reference to the first object. "aliasConfig" now references the '{...}' object
module.exports = merge(envConfig.toWebpackConfig(), aliasConfig)
"module.exports" is assigned the result of the merge function (if it is using webpack-merge package, this object is a deep merge of the two). It lost reference to the previous objects.
Declaring module.exports the first times was not necessary.
Webpack config works like any nodejs module. Here is the link to the documentation on module.exports https://nodejs.org/api/modules.html#modules_module_exports
Also note that using the double assignment syntax can be considered dangerous because of how hoisting works in javascript. If I recall it's easy to create global variables that we don't want/expect that way.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rails-webpacker
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page