Update from webpacker v5 to shakapacker v6.0.0.rc13

Using a two-step process is recommended:
332e25186a/docs/v6_upgrade.md
This commit is contained in:
Sebastian Serth
2022-08-11 23:52:56 +02:00
parent e2a87c5ae0
commit d223abfb5e
37 changed files with 1374 additions and 4624 deletions

View File

@ -0,0 +1,47 @@
// See the shakacode/shakapacker README and docs directory for advice on customizing your webpackConfig.
const { webpackConfig, merge } = require('shakapacker')
const webpack = require('webpack');
// Custom ERB loader to disable Spring and prevent crashes
const erb = require("./loaders/erb");
// This setting will change the absolute path used to refer
// external files (images, fonts, ...) in the generated assets
const relative_url_root = process.env.RAILS_RELATIVE_URL_ROOT || '';
const public_output_path = webpackConfig.output.publicPath;
const envConfig = module.exports = {
output: {
publicPath: relative_url_root + public_output_path
},
module: {
rules: [
erb
]
},
resolve: {
alias: {
$: 'jquery/src/jquery',
jquery: 'jquery/src/jquery',
}
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
JQuery: 'jquery',
jQuery: 'jquery',
jquery: 'jquery',
'window.Tether': "tether",
Popper: ['popper.js', 'default'], // for Bootstrap 4
_: 'underscore',
vis: 'vis',
hljs: 'highlight.js',
d3: 'd3',
Sentry: '@sentry/browser',
Sortable: 'sortablejs',
})
]
}
module.exports = merge(webpackConfig, envConfig)