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) {
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(
@ -12,13 +12,13 @@ module.exports = function(api) {
'"test", and "production". Instead, received: ' +
JSON.stringify(currentEnv) +
'.'
);
)
}
return {
presets: [
isTestEnv && [
require('@babel/preset-env').default,
'@babel/preset-env',
{
targets: {
node: 'current'
@ -26,7 +26,7 @@ module.exports = function(api) {
}
],
(isProductionEnv || isDevelopmentEnv) && [
require('@babel/preset-env').default,
'@babel/preset-env',
{
forceAllTransforms: true,
useBuiltIns: 'usage',
@ -36,7 +36,7 @@ module.exports = function(api) {
}
],
[
require('@babel/preset-react').default,
'@babel/preset-react',
{
development: isDevelopmentEnv || isTestEnv,
useBuiltIns: true
@ -44,41 +44,53 @@ module.exports = function(api) {
]
].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,
'babel-plugin-macros',
'@babel/plugin-syntax-dynamic-import',
isTestEnv && 'babel-plugin-dynamic-import-node',
'@babel/plugin-transform-destructuring',
[
require('@babel/plugin-proposal-class-properties').default,
'@babel/plugin-proposal-class-properties',
{
loose: true
}
],
[
require('@babel/plugin-proposal-object-rest-spread').default,
'@babel/plugin-proposal-object-rest-spread',
{
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,
regenerator: true
}
],
[
require('@babel/plugin-transform-regenerator').default,
'@babel/plugin-transform-regenerator',
{
async: false
}
],
isProductionEnv && [
require('babel-plugin-transform-react-remove-prop-types').default,
'babel-plugin-transform-react-remove-prop-types',
{
removeImport: true
}
]
].filter(Boolean)
};
};
}
}

View file

@ -1,15 +1,18 @@
#!/usr/bin/env ruby
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development"
ENV["NODE_ENV"] ||= "development"
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "rubygems"
require "bundler/setup"
require "webpacker"
require "webpacker/webpack_runner"
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
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development"
ENV["NODE_ENV"] ||= "development"
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
require "rubygems"
require "bundler/setup"
require "webpacker"
require "webpacker/dev_server_runner"
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_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']
resolved_paths: []
additional_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
@ -53,9 +52,6 @@ development:
<<: *default
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/
dev_server:
https: false
@ -70,6 +66,7 @@ development:
disable_host_check: true
use_local_ip: false
quiet: false
pretty: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:

View file

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

View file

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

2636
yarn.lock

File diff suppressed because it is too large Load diff