Update webpack config to match newest webpacker gem

This commit is contained in:
Sebastian Serth
2020-12-01 17:58:33 +01:00
parent d58b49f71f
commit f201804486
12 changed files with 142 additions and 142 deletions

1
.browserslistrc Normal file
View File

@ -0,0 +1 @@
defaults

2
.gitignore vendored
View File

@ -22,9 +22,9 @@
/.vagrant
*.iml
*.DS_Store
/node_modules
/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity

View File

@ -1,70 +1,70 @@
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 ' +
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(currentEnv) +
'.'
)
}
if (!validEnv.includes(currentEnv)) {
throw new Error(
'Please specify a valid `NODE_ENV` or ' +
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(currentEnv) +
'.'
)
}
return {
presets: [
isTestEnv && [
require('@babel/preset-env').default,
{
targets: {
node: 'current'
}
}
],
(isProductionEnv || isDevelopmentEnv) && [
require('@babel/preset-env').default,
{
forceAllTransforms: true,
useBuiltIns: 'entry',
modules: false,
exclude: ['transform-typeof-symbol']
}
]
].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-proposal-class-properties').default,
{
loose: true
}
],
[
require('@babel/plugin-proposal-object-rest-spread').default,
{
useBuiltIns: true
}
],
[
require('@babel/plugin-transform-runtime').default,
{
helpers: false,
regenerator: true
}
],
[
require('@babel/plugin-transform-regenerator').default,
{
async: false
}
]
].filter(Boolean)
}
};
return {
presets: [
isTestEnv && [
'@babel/preset-env',
{
targets: {
node: 'current'
}
}
],
(isProductionEnv || isDevelopmentEnv) && [
'@babel/preset-env',
{
forceAllTransforms: true,
useBuiltIns: 'entry',
corejs: 3,
modules: false,
exclude: ['transform-typeof-symbol']
}
]
].filter(Boolean),
plugins: [
'babel-plugin-macros',
'@babel/plugin-syntax-dynamic-import',
isTestEnv && 'babel-plugin-dynamic-import-node',
'@babel/plugin-transform-destructuring',
[
'@babel/plugin-proposal-class-properties',
{
loose: true
}
],
[
'@babel/plugin-proposal-object-rest-spread',
{
useBuiltIns: true
}
],
[
'@babel/plugin-transform-runtime',
{
helpers: false
}
],
[
'@babel/plugin-transform-regenerator',
{
async: false
}
]
].filter(Boolean)
}
}

View File

@ -11,6 +11,11 @@
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
#
# # You need to allow webpack-dev-server host as allowed origin for connect-src.
# # This can be done in Rails 5.2+ for development environment in the CSP initializer
# # config/initializers/content_security_policy.rb with a snippet like this:
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"

View File

@ -1,5 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment');
const environment = require('./environment')
module.exports = environment;
module.exports = environment

View File

@ -4,9 +4,9 @@ Info for this file can be found
github.com/rails/webpacker/blob/master/docs/webpack.md
*/
const { environment } = require('@rails/webpacker');
const { merge } = require('webpack-merge');
const webpack = require('webpack');
const { environment } = require('@rails/webpacker')
const { merge } = require('webpack-merge')
const webpack = require('webpack')
// Add an additional plugin of your choosing : ProvidePlugin
environment.plugins.prepend('Provide', new webpack.ProvidePlugin({
@ -22,15 +22,15 @@ environment.plugins.prepend('Provide', new webpack.ProvidePlugin({
Sentry: '@sentry/browser',
Sortable: 'sortablejs',
})
);
)
const envConfig = module.exports = environment;
const envConfig = module.exports = environment
const aliasConfig = module.exports = {
resolve: {
alias: {
jquery: 'jquery/src/jquery',
}
}
};
}
module.exports = merge(envConfig.toWebpackConfig(), aliasConfig);
module.exports = merge(envConfig.toWebpackConfig(), aliasConfig)

View File

@ -1,5 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const environment = require('./environment');
const environment = require('./environment')
module.exports = environment;
module.exports = environment

View File

@ -1,5 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment');
const environment = require('./environment')
module.exports = environment;
module.exports = environment

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
@ -52,15 +51,12 @@ 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
host: 0.0.0.0
host: localhost
port: 3035
public: 0.0.0.0:3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: true
@ -69,12 +65,11 @@ development:
disable_host_check: true
use_local_ip: false
quiet: false
pretty: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: /node_modules/
# File Watcher might not work inside Vagrant
poll: true
ignored: '**/node_modules/**'
test:

View File

@ -18,7 +18,6 @@
"sortablejs": "^1.12.0",
"underscore": "^1.12.0",
"vis": "^4.21.0",
"webpack": "^4.44.2",
"webpack-merge": "^5.4.0"
},
"devDependencies": {

View File

@ -1,12 +1,12 @@
module.exports = {
plugins: [
require('postcss-import'),
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009'
},
stage: 3
})
]
};
plugins: [
require('postcss-import'),
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009'
},
stage: 3
})
]
}

View File

@ -887,55 +887,55 @@
webpack-sources "^1.4.3"
"@sentry/browser@^5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.27.6.tgz#54fe177e9986246586b0761eb38cbad1ad07ecb5"
integrity sha512-pqrojE2ZmLUVz7l/ogtogK0+M2pK3bigYm0fja7vG7F7kXnCAwqAHDYfkFXEvFI8WvNwH+niy28lSoV95lnm0Q==
version "5.28.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.28.0.tgz#f4c094bb97070442d95d51966a5e4dc8b92f586f"
integrity sha512-u1W47fgYFGWTV+RRQtNBzPZMXfR4MqCYSpuUVSpWQ+riITH7pvjG1cnBYDGT7+Q1s1wGrAL/9ElJfF795VVT9g==
dependencies:
"@sentry/core" "5.27.6"
"@sentry/types" "5.27.6"
"@sentry/utils" "5.27.6"
"@sentry/core" "5.28.0"
"@sentry/types" "5.28.0"
"@sentry/utils" "5.28.0"
tslib "^1.9.3"
"@sentry/core@5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.27.6.tgz#3ceeb58acd857f1e17d52d3087bfecb506adc1f7"
integrity sha512-izCS5iyc6HAfpW1AsGXLAKetx82C1Sq1siAh97tOlSK58PVJAEH/WMiej9WuZJxCDTOtj94QtoLflssrZyAtFg==
"@sentry/core@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.28.0.tgz#2b5ee2b76f0ccd73545eac61c3c2d72d7c76f531"
integrity sha512-hLAUFauqX+v/ap8ATJFdp392ZvfFoR0Gb4pyRkzOeWWs5ZYuqyb9Dsjtwsb61HH/XHQGW/BKZJR2dgIjQq4JGA==
dependencies:
"@sentry/hub" "5.27.6"
"@sentry/minimal" "5.27.6"
"@sentry/types" "5.27.6"
"@sentry/utils" "5.27.6"
"@sentry/hub" "5.28.0"
"@sentry/minimal" "5.28.0"
"@sentry/types" "5.28.0"
"@sentry/utils" "5.28.0"
tslib "^1.9.3"
"@sentry/hub@5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.27.6.tgz#a94adbe32c45dda7ad5adf742b82e0a022eb9c2f"
integrity sha512-bOMky3iu7zEghSaWmTayfme5tCpUok841qDCGxGKuyAtOhBDsgGNS/ApNEEDF2fyX0oo4G1cHYPWhX90ZFf/xA==
"@sentry/hub@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.28.0.tgz#6a00b1011c0492b6acbaf0e24961fbd1c7edd1c1"
integrity sha512-1k19yJJcKoHbw12FET35t0m86lx/X6eJ6r4qM13eb2WN/OpoFtsgs1IjQOhGFL3OfVMcfh800Lc57ga04RLjLA==
dependencies:
"@sentry/types" "5.27.6"
"@sentry/utils" "5.27.6"
"@sentry/types" "5.28.0"
"@sentry/utils" "5.28.0"
tslib "^1.9.3"
"@sentry/minimal@5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.27.6.tgz#783012ed94668be168f2b521e0ea6295c76ce2b0"
integrity sha512-pKhzVQX9nL4m1dcnb2i2Y47IWVNs+K3wiYLgCB9hl9+ApxppfOc+fquiFoCloST3IuaD4yly2TtbOJgAMWcMxQ==
"@sentry/minimal@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.28.0.tgz#bfa63f5961988e6652207c77b3ea46d89f2d52bf"
integrity sha512-HzFrJx0xe5KETEZc7RxlH+1TfmH3q8w35ILOP5HGvk3+lG1DR25wHbMFmuUqNqVXrl26t0z32UBI30G1MxmTfA==
dependencies:
"@sentry/hub" "5.27.6"
"@sentry/types" "5.27.6"
"@sentry/hub" "5.28.0"
"@sentry/types" "5.28.0"
tslib "^1.9.3"
"@sentry/types@5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.27.6.tgz#b5054eafcb8ac11d4bc4787c7bc7fc113cad8b80"
integrity sha512-XOW9W8DrMk++4Hk7gWi9o5VR0o/GrqGfTKyFsHSIjqt2hL6kiMPvKeb2Hhmp7Iq37N2bDmRdWpM5m+68S2Jk6w==
"@sentry/types@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.28.0.tgz#242131fef910bded53350a36ffd7df240cfb8dcf"
integrity sha512-nNhoZEXdqM2xivxJBrLhxtJ2+s6FfKXUw5yBf0Jf/RBrBnH5fggPNImmyfpOoysl72igWcMWk4nnfyP5iDrriQ==
"@sentry/utils@5.27.6":
version "5.27.6"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.27.6.tgz#cd8486469ae9716a21a4bc7e828e5aeee0ed9727"
integrity sha512-/QMVLv+zrTfiIj2PU+SodSbSzD5MmamMOaljkDsRIVsj6gpkm1/VG1g2+40TZ0FbQ4hCW2F+iR7cnqzZBNmchA==
"@sentry/utils@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.28.0.tgz#a30e36afd7094ced8d585c9fde2df2636cca6cf5"
integrity sha512-LW+ReVw9JG6g8Bvp2I1ThMDPATlisvkde+1WykxGqRhu2YIO+PvWhnoFhr9RD0ia3rYVlJkgkuTshMbPJ8HVwA==
dependencies:
"@sentry/types" "5.27.6"
"@sentry/types" "5.28.0"
tslib "^1.9.3"
"@types/glob@^7.1.1":
@ -7862,7 +7862,7 @@ webpack-sources@^1.0.0, webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-
source-list-map "^2.0.0"
source-map "~0.6.1"
webpack@^4.44.1, webpack@^4.44.2:
webpack@^4.44.1:
version "4.44.2"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.44.2.tgz#6bfe2b0af055c8b2d1e90ed2cd9363f841266b72"
integrity sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q==