Skip to content
Permalink
Browse files

Upgrade to webpacker 4 RC2

  • Loading branch information
harigopal committed Dec 17, 2018
1 parent 10caa44 commit 3120cd6cd55afcc3670b7b526a1b874f7169d877
Showing with 294 additions and 158 deletions.
  1. +1 −0 .browserslistrc
  2. +2 −5 .gitignore
  3. +1 −1 Gemfile
  4. +7 −12 Gemfile.lock
  5. +26 −26 babel.config.js
  6. +5 −1 bin/webpack
  7. +5 −1 bin/webpack-dev-server
  8. +2 −13 config/webpack/environment.js
  9. +23 −4 config/webpacker.yml
  10. +2 −2 package.json
  11. +220 −93 yarn.lock
@@ -0,0 +1 @@
> 1%
@@ -32,11 +32,8 @@ yarn-debug.log*

# Ignore these associated with reason-react and bsb
.merlin
/node_modules/
/lib/*
!/lib/js/*
/bundledOutputs/
lib/bs/
npm-debug.log
.DS_Store
.bsb.lock
*.bs.js
*.bs.js
@@ -22,7 +22,7 @@ gem 'carrierwave-bombshelter', '~> 0.2' # Protects your carrierwave from image b
gem 'fog-aws', '~> 3.0', require: 'fog/aws' # Required by Carrierwave to upload to S3.

# Use Webpack to manage app-like JavaScript modules in Rails.
gem 'webpacker', '= 4.0.0.pre.3', github: 'rails/webpacker' # TODO: Switch to release v4 when available.
gem 'webpacker', '= 4.0.0.rc.2'

gem 'coffee-rails', '~> 4.2.0' # Coffeescript on Rails.
gem 'devise', '~> 4.2' # User auth library.
@@ -51,15 +51,6 @@ GIT
json (>= 1.8.3)
signet (~> 0.7)

GIT
remote: https://github.com/rails/webpacker.git
revision: 99c0dd9a1e5fa9ca9ad840d7e308c12c4e8eb9ec
specs:
webpacker (4.0.0.pre.3)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)

GIT
remote: https://github.com/svdotco/lita.git
revision: 94861d1270de373b1147c5e9162976becdfaac1c
@@ -235,7 +226,7 @@ GEM
coffee-script-source (1.12.2)
combine_pdf (1.0.15)
ruby-rc4 (>= 0.1.5)
concurrent-ruby (1.1.3)
concurrent-ruby (1.1.4)
connection_pool (2.2.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
@@ -405,7 +396,7 @@ GEM
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
humanize (1.8.1)
i18n (1.1.1)
i18n (1.2.0)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
inherited_resources (1.9.0)
@@ -797,6 +788,10 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
webpacker (4.0.0.rc.2)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
@@ -938,7 +933,7 @@ DEPENDENCIES
virtus (~> 1.0)
web-console (~> 3.4)
webmock (~> 3.0)
webpacker (= 4.0.0.pre.3)!
webpacker (= 4.0.0.rc.2)

RUBY VERSION
ruby 2.5.3p105
@@ -1,83 +1,83 @@
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
var isTestEnv = api.env('test')
var validEnv = ["development", "test", "production"];
var currentEnv = api.env();
var isDevelopmentEnv = api.env("development");
var isProductionEnv = api.env("production");
var isTestEnv = api.env("test");

if (!validEnv.includes(currentEnv)) {
throw new Error(
'Please specify a valid `NODE_ENV` or ' +
"Please specify a valid `NODE_ENV` or " +
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(env) +
'.'
)
JSON.stringify(currentEnv) +
"."
);
}

return {
presets: [
isTestEnv && [
require('@babel/preset-env').default,
require("@babel/preset-env").default,
{
targets: {
node: 'current'
node: "current"
}
}
],
(isProductionEnv || isDevelopmentEnv) && [
require('@babel/preset-env').default,
require("@babel/preset-env").default,
{
forceAllTransforms: true,
useBuiltIns: 'entry',
useBuiltIns: "entry",
modules: false,
exclude: ['transform-typeof-symbol']
exclude: ["transform-typeof-symbol"]
}
],
[
require('@babel/preset-react').default,
require("@babel/preset-react").default,
{
development: isDevelopmentEnv || isTestEnv,
useBuiltIns: true
}
]
].filter(Boolean),
plugins: [
require('babel-plugin-macros'),
require('@babel/plugin-syntax-dynamic-import').default,
isTestEnv && require('babel-plugin-dynamic-import-node'),
require('@babel/plugin-transform-destructuring').default,
require("babel-plugin-macros"),
require("@babel/plugin-syntax-dynamic-import").default,
isTestEnv && require("babel-plugin-dynamic-import-node"),
require("@babel/plugin-transform-destructuring").default,
[
require('@babel/plugin-proposal-class-properties').default,
require("@babel/plugin-proposal-class-properties").default,
{
loose: true
}
],
[
require('@babel/plugin-proposal-object-rest-spread').default,
require("@babel/plugin-proposal-object-rest-spread").default,
{
useBuiltIns: true
}
],
[
require('@babel/plugin-transform-runtime').default,
require("@babel/plugin-transform-runtime").default,
{
helpers: false,
regenerator: true
}
],
[
require('@babel/plugin-transform-regenerator').default,
require("@babel/plugin-transform-regenerator").default,
{
async: false
}
],
isProductionEnv && [
require('babel-plugin-transform-react-remove-prop-types').default,
require("babel-plugin-transform-react-remove-prop-types").default,
{
removeImport: true
}
]
].filter(Boolean)
}
}
};
};
@@ -12,4 +12,8 @@ require "bundler/setup"

require "webpacker"
require "webpacker/webpack_runner"
Webpacker::WebpackRunner.run(ARGV)

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::WebpackRunner.run(ARGV)
end
@@ -12,4 +12,8 @@ require "bundler/setup"

require "webpacker"
require "webpacker/dev_server_runner"
Webpacker::DevServerRunner.run(ARGV)

APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::DevServerRunner.run(ARGV)
end
@@ -1,14 +1,3 @@
const { environment } = require("@rails/webpacker");
const merge = require("webpack-merge");
const { environment } = require('@rails/webpacker')

const cssModulesOptions = {
// This must match the value of generateScopedName
// in the .babelrc settings of react-css-modules.
localIdentName: "[path]___[name]__[local]___[hash:base64:5]"
}

const CSSLoader = environment.loaders.get('moduleSass').use.find(el => el.loader === 'css-loader')

CSSLoader.options = merge(CSSLoader.options, cssModulesOptions)

module.exports = environment;
module.exports = environment
@@ -5,6 +5,8 @@ default: &default
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false
webpack_compile_output: false

# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
@@ -13,13 +15,27 @@ default: &default
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false

# Extract and emit a css file in all environments by default.
extract_css: true

static_assets_extensions:
- .jpg
- .jpeg
- .png
- .gif
- .tiff
- .ico
- .svg
- .eot
- .otf
- .ttf
- .woff
- .woff2

extensions:
- .coffee
- .erb
- .mjs
- .js
- .jsx
- .ts
- .vue
- .sass
- .scss
- .css
@@ -36,6 +52,9 @@ development:
<<: *default
compile: true

# Verifies that versions and hashed value of the package contents in the project's package.json
check_yarn_integrity: true

# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
@@ -4,7 +4,7 @@
"dependencies": {
"@babel/preset-react": "^7.0.0",
"@glennsl/bs-json": "^2.0.0",
"@rails/webpacker": "https://github.com/rails/webpacker.git",
"@rails/webpacker": "https://github.com/rails/webpacker",
"babel-plugin-react-css-modules": "^3.3.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"babel-preset-react": "^6.24.1",
@@ -29,7 +29,7 @@
"reason-react": ">=0.3.4",
"sass-loader": "^7.0.1",
"tailwindcss": "^0.7.2",
"webpack-dev-server": "3.1.10"
"webpack-dev-server": "^3.1.10"
},
"scripts": {
"postinstall": "bsb -make-world"

0 comments on commit 3120cd6

Please sign in to comment.
You can’t perform that action at this time.