Skip to content

Commit

Permalink
Upgrading to Webpacker 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumebriday committed Jul 15, 2021
1 parent 26ec514 commit 650f39e
Show file tree
Hide file tree
Showing 17 changed files with 1,000 additions and 2,325 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
gem 'webpacker', '6.0.0.beta.7'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ GEM
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
webpacker (5.4.0)
webpacker (6.0.0.beta.7)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
Expand Down Expand Up @@ -218,7 +218,7 @@ DEPENDENCIES
tzinfo-data
web-console (>= 4.1.0)
webdrivers
webpacker (~> 5.0)
webpacker (= 6.0.0.beta.7)

RUBY VERSION
ruby 2.7.3p183
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_packs_with_chunks_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_packs_with_chunks_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>

<body>
Expand Down
70 changes: 0 additions & 70 deletions babel.config.js

This file was deleted.

22 changes: 22 additions & 0 deletions config/webpack/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { webpackConfig, merge } = require('@rails/webpacker')
const { VueLoaderPlugin } = require('vue-loader')

module.exports = merge({
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
}
]
},
plugins: [
new VueLoaderPlugin()
],
resolve: {
extensions: ['.css', '.vue'],
alias: {
vue: 'vue/dist/vue.esm'
}
}
}, webpackConfig)
4 changes: 1 addition & 3 deletions config/webpack/development.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'

const environment = require('./environment')

module.exports = environment.toWebpackConfig()
module.exports = require('./base')
22 changes: 0 additions & 22 deletions config/webpack/environment.js

This file was deleted.

7 changes: 3 additions & 4 deletions config/webpack/production.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'production'

const environment = require('./environment')
const { merge } = require('@rails/webpacker')
const webpackConfig = require('./base')

environment.config.merge({
module.exports = merge(webpackConfig, {
resolve: {
alias: {
vue: 'vue/dist/vue.min'
}
}
})

module.exports = environment.toWebpackConfig()
4 changes: 1 addition & 3 deletions config/webpack/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development'

const environment = require('./environment')

module.exports = environment.toWebpackConfig()
module.exports = require('./base')
34 changes: 2 additions & 32 deletions config/webpacker.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Note: You must restart bin/webpack-dev-server for changes to take effect

default: &default
source_path: app/javascript
source_entry_path: packs
source_path: app/packs
source_entry_path: entrypoints
public_root_path: public
public_output_path: packs
cache_path: tmp/cache/webpacker
Expand All @@ -18,36 +18,6 @@ default: &default
# Extract and emit a css file
extract_css: false

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

extensions:
- .mjs
- .js
- .sass
- .scss
- .css
- .module.sass
- .module.scss
- .module.css
- .png
- .svg
- .gif
- .jpeg
- .jpg
- .vue

development:
<<: *default
compile: true
Expand Down
21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,31 @@
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "5.4.0",
"@rails/webpacker": "6.0.0-beta.7",
"css-loader": "^6.0.0",
"css-minimizer-webpack-plugin": "^3.0.2",
"mini-css-extract-plugin": "^2.1.0",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-focus": "^5.0.1",
"postcss-import": "^14.0.2",
"postcss-loader": "^6.1.1",
"postcss-preset-env": "^6.7.0",
"sass": "^1.35.2",
"sass-loader": "^12.1.0",
"turbolinks": "^5.2.0",
"vue": "^2.6.14",
"vue-loader": "^15.9.7",
"vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
"webpack": "^5.44.0",
"webpack-cli": "^4.7.2"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^3.11.2"
},
"babel": {
"presets": [
"./node_modules/@rails/webpacker/package/babel/preset.js"
]
}
}
Loading

0 comments on commit 650f39e

Please sign in to comment.