app: upgrade webpacker by running rails webpacker:install

This commit is contained in:
Pierre de La Morinerie 2021-09-16 08:37:53 -05:00
parent 275eb389d0
commit f277731b3d
7 changed files with 1362 additions and 1359 deletions

View file

@ -1,9 +1,9 @@
module.exports = function(api) { module.exports = function(api) {
var validEnv = ['development', 'test', 'production']; var validEnv = ['development', 'test', 'production']
var currentEnv = api.env(); var currentEnv = api.env()
var isDevelopmentEnv = api.env('development'); var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production'); var isProductionEnv = api.env('production')
var isTestEnv = api.env('test'); var isTestEnv = api.env('test')
if (!validEnv.includes(currentEnv)) { if (!validEnv.includes(currentEnv)) {
throw new Error( throw new Error(
@ -12,13 +12,13 @@ module.exports = function(api) {
'"test", and "production". Instead, received: ' + '"test", and "production". Instead, received: ' +
JSON.stringify(currentEnv) + JSON.stringify(currentEnv) +
'.' '.'
); )
} }
return { return {
presets: [ presets: [
isTestEnv && [ isTestEnv && [
require('@babel/preset-env').default, '@babel/preset-env',
{ {
targets: { targets: {
node: 'current' node: 'current'
@ -26,7 +26,7 @@ module.exports = function(api) {
} }
], ],
(isProductionEnv || isDevelopmentEnv) && [ (isProductionEnv || isDevelopmentEnv) && [
require('@babel/preset-env').default, '@babel/preset-env',
{ {
forceAllTransforms: true, forceAllTransforms: true,
useBuiltIns: 'usage', useBuiltIns: 'usage',
@ -36,7 +36,7 @@ module.exports = function(api) {
} }
], ],
[ [
require('@babel/preset-react').default, '@babel/preset-react',
{ {
development: isDevelopmentEnv || isTestEnv, development: isDevelopmentEnv || isTestEnv,
useBuiltIns: true useBuiltIns: true
@ -44,41 +44,53 @@ module.exports = function(api) {
] ]
].filter(Boolean), ].filter(Boolean),
plugins: [ plugins: [
require('babel-plugin-macros'), 'babel-plugin-macros',
require('@babel/plugin-syntax-dynamic-import').default, '@babel/plugin-syntax-dynamic-import',
isTestEnv && require('babel-plugin-dynamic-import-node'), isTestEnv && 'babel-plugin-dynamic-import-node',
require('@babel/plugin-transform-destructuring').default, '@babel/plugin-transform-destructuring',
[ [
require('@babel/plugin-proposal-class-properties').default, '@babel/plugin-proposal-class-properties',
{ {
loose: true loose: true
} }
], ],
[ [
require('@babel/plugin-proposal-object-rest-spread').default, '@babel/plugin-proposal-object-rest-spread',
{ {
useBuiltIns: true useBuiltIns: true
} }
], ],
[ [
require('@babel/plugin-transform-runtime').default, '@babel/plugin-proposal-private-methods',
{
loose: true
}
],
[
'@babel/plugin-proposal-private-property-in-object',
{
loose: true
}
],
[
'@babel/plugin-transform-runtime',
{ {
helpers: false, helpers: false,
regenerator: true regenerator: true
} }
], ],
[ [
require('@babel/plugin-transform-regenerator').default, '@babel/plugin-transform-regenerator',
{ {
async: false async: false
} }
], ],
isProductionEnv && [ isProductionEnv && [
require('babel-plugin-transform-react-remove-prop-types').default, 'babel-plugin-transform-react-remove-prop-types',
{ {
removeImport: true removeImport: true
} }
] ]
].filter(Boolean) ].filter(Boolean)
}; }
}; }

View file

@ -1,15 +1,18 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development" ENV["NODE_ENV"] ||= "development"
require "pathname" require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath) Pathname.new(__FILE__).realpath)
require "rubygems"
require "bundler/setup" require "bundler/setup"
require "webpacker" require "webpacker"
require "webpacker/webpack_runner" require "webpacker/webpack_runner"
Webpacker::WebpackRunner.run(ARGV)
APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::WebpackRunner.run(ARGV)
end

View file

@ -1,15 +1,18 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development" ENV["NODE_ENV"] ||= "development"
require "pathname" require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath) Pathname.new(__FILE__).realpath)
require "rubygems"
require "bundler/setup" require "bundler/setup"
require "webpacker" require "webpacker"
require "webpacker/dev_server_runner" 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

View file

@ -6,12 +6,11 @@ default: &default
public_root_path: public public_root_path: public
public_output_path: packs public_output_path: packs
cache_path: tmp/cache/webpacker cache_path: tmp/cache/webpacker
check_yarn_integrity: false
webpack_compile_output: false webpack_compile_output: false
# Additional paths webpack should lookup modules # Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets'] # ['app/assets', 'engine/foo/app/assets']
resolved_paths: [] additional_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs # Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false cache_manifest: false
@ -53,9 +52,6 @@ development:
<<: *default <<: *default
compile: true compile: true
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
check_yarn_integrity: true
# Reference: https://webpack.js.org/configuration/dev-server/ # Reference: https://webpack.js.org/configuration/dev-server/
dev_server: dev_server:
https: false https: false
@ -70,6 +66,7 @@ development:
disable_host_check: true disable_host_check: true
use_local_ip: false use_local_ip: false
quiet: false quiet: false
pretty: false
headers: headers:
'Access-Control-Allow-Origin': '*' 'Access-Control-Allow-Origin': '*'
watch_options: watch_options:

View file

@ -8,7 +8,7 @@
"@rails/actiontext": "^6.1.4-1", "@rails/actiontext": "^6.1.4-1",
"@rails/activestorage": "^6.1.4-1", "@rails/activestorage": "^6.1.4-1",
"@rails/ujs": "^6.1.4-1", "@rails/ujs": "^6.1.4-1",
"@rails/webpacker": "5.1.1", "@rails/webpacker": "5.4.3",
"@reach/combobox": "^0.13.0", "@reach/combobox": "^0.13.0",
"@reach/slider": "^0.15.0", "@reach/slider": "^0.15.0",
"@reach/visually-hidden": "^0.15.2", "@reach/visually-hidden": "^0.15.2",
@ -39,6 +39,8 @@
"react_ujs": "^2.6.1", "react_ujs": "^2.6.1",
"trix": "^1.2.3", "trix": "^1.2.3",
"use-debounce": "^5.2.0", "use-debounce": "^5.2.0",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"whatwg-fetch": "^3.0.0" "whatwg-fetch": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
@ -52,7 +54,7 @@
"netlify-cli": "^2.61.2", "netlify-cli": "^2.61.2",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"webpack-bundle-analyzer": "^3.7.0", "webpack-bundle-analyzer": "^3.7.0",
"webpack-dev-server": "^3.11.0" "webpack-dev-server": "^3"
}, },
"scripts": { "scripts": {
"lint:js": "eslint --ext .js,.jsx,.ts,.tsx ./app/javascript ./config/webpack", "lint:js": "eslint --ext .js,.jsx,.ts,.tsx ./app/javascript ./config/webpack",

View file

@ -9,4 +9,4 @@ module.exports = {
stage: 3 stage: 3
}) })
] ]
}; }

2636
yarn.lock

File diff suppressed because it is too large Load diff