Permalink
Browse files

adding the webpacker gem and initial webpack setup

  • Loading branch information...
ejdraper committed Jan 5, 2018
1 parent 3c7cd6d commit eb408b923ab907d5be64081dc3847fc4a80dc1cc
@@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
["transform-class-properties", { "spec": true }]
]
}
@@ -21,3 +21,6 @@
/yarn-error.log
.byebug_history
/public/packs
/public/packs-test
/node_modules
@@ -0,0 +1,3 @@
plugins:
postcss-import: {}
postcss-cssnext: {}
@@ -33,6 +33,8 @@ gem 'jbuilder', '~> 2.5'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem "webpacker"
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
@@ -92,6 +92,8 @@ GEM
public_suffix (3.0.1)
puma (3.11.0)
rack (2.0.3)
rack-proxy (0.6.3)
rack
rack-test (0.8.2)
rack (>= 1.0, < 3)
rails (5.1.4)
@@ -165,6 +167,10 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webpacker (3.2.0)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
@@ -191,6 +197,7 @@ DEPENDENCIES
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
webpacker
BUNDLED WITH
1.16.0
@@ -0,0 +1,10 @@
/* eslint no-console:0 */
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb
console.log('Hello World from Webpacker')
@@ -0,0 +1,21 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'webpack' is installed as part of a gem, and
# this file is here to facilitate running it.
#
bundle_binstub = File.expand_path("../bundle", __FILE__)
load(bundle_binstub) if File.file?(bundle_binstub)
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "rubygems"
require "bundler/setup"
load Gem.bin_path("webpacker", "webpack")
@@ -0,0 +1,21 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'webpack-dev-server' is installed as part of a gem, and
# this file is here to facilitate running it.
#
bundle_binstub = File.expand_path("../bundle", __FILE__)
load(bundle_binstub) if File.file?(bundle_binstub)
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "rubygems"
require "bundler/setup"
load Gem.bin_path("webpacker", "webpack-dev-server")
@@ -1,4 +1,7 @@
Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = true
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
@@ -1,4 +1,7 @@
Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = false
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
@@ -0,0 +1,3 @@
const environment = require('./environment')
module.exports = environment.toWebpackConfig()
@@ -0,0 +1,3 @@
const { environment } = require('@rails/webpacker')
module.exports = environment
@@ -0,0 +1,3 @@
const environment = require('./environment')
module.exports = environment.toWebpackConfig()
@@ -0,0 +1,3 @@
const environment = require('./environment')
module.exports = environment.toWebpackConfig()
@@ -0,0 +1,70 @@
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app/javascript
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
extensions:
- .coffee
- .erb
- .js
- .jsx
- .ts
- .vue
- .sass
- .scss
- .css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
compile: true
# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: /node_modules/
test:
<<: *default
compile: true
# Compile test packs to a separate directory
public_output_path: packs-test
production:
<<: *default
# Production depends on precompilation of packs prior to booting for performance.
compile: false
# Cache manifest.json for performance
cache_manifest: true
@@ -1,5 +1,11 @@
{
"name": "frontend-fun",
"private": true,
"dependencies": {}
"dependencies": {
"@rails/webpacker": "^3.2.0",
"coffeescript": "1.12.7"
},
"devDependencies": {
"webpack-dev-server": "^2.9.7"
}
}
Oops, something went wrong.

0 comments on commit eb408b9

Please sign in to comment.