Skip to content

Instantly share code, notes, and snippets.

@tai2
Last active January 17, 2018 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tai2/bf284bd00039eabf405049ad42275bd1 to your computer and use it in GitHub Desktop.
Save tai2/bf284bd00039eabf405049ad42275bd1 to your computer and use it in GitHub Desktop.
webpacker 2からwebpacker 3への移行作業のログ

Webpacker 2 → Webpacker 3 移行ログ

webpackerを3に更新

./bin/bundle update webpacker

webpacker npmパッケージをインストール

yarn upgrade @rails/webpacker --latest

webpacker 2設定を削除

rm -rf config/webpack/

webpacker 3設定をインストール

./bin/rails webpacker:install # choose Y all
rm -rf app/javascript/ # ディレクトリデフォルトから変えてるので不要

binstubを更新

./bin/bundle config --delete bin
./bin/rails app:update:bin

webpack 3でアプリから直接依存しなくなったモジュールを削除

消さないとバッティングしてビルドでエラー

yarn remove webpack webpack-manifest-plugin extract-text-webpack-plugin compression-webpack-plugin css-loader file-loader glob node-sass js-yaml path-complete-extname coffee-loader coffee-script babel-core babel-loader babel-plugin-syntax-dynamic-import babel-plugin-transform-class-properties babel-plugin-transform-object-rest-spread babel-preset-env prop-types rails-erb-loader postcss-loader resolve-url-loader sass-loader style-loader

残りの設定調整

  • .postcssrc.yml修正(cssnextとsmart-importははずして、autoprefixerのみに変更)
  • ts-loaderをawesome-typescript-loaderに変更
  • styleローダーをグローバルとローカル両方扱えるように修正
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment