-
Notifications
You must be signed in to change notification settings - Fork 1k
Fixes #21203 - Move from webpack-rails to webpacker #5033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,31 @@ | ||
| { | ||
| "presets": ["env", "react"], | ||
| "presets": [ | ||
| [ | ||
| "env", | ||
| { | ||
| "modules": false, | ||
| "targets": { | ||
| "browsers": "> 1%", | ||
| "uglify": true | ||
| }, | ||
| "useBuiltIns": true | ||
| } | ||
| ], | ||
| "react" | ||
| ], | ||
| "plugins": [ | ||
| "transform-class-properties", | ||
| "syntax-dynamic-import", | ||
| "transform-object-rest-spread", | ||
| "transform-object-assign" | ||
| ] | ||
| [ | ||
| "transform-class-properties", | ||
| { | ||
| "spec": true | ||
| } | ||
| ] | ||
| ], | ||
| "env": { | ||
| "test": { | ||
| "presets": ["env", "react"] | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,3 +47,5 @@ public/webpack | |
| package-lock.json | ||
| npm-debug.log | ||
| .vscode | ||
| /public/packs | ||
| /public/packs-test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| plugins: | ||
| postcss-smart-import: {} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this file for?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| postcss-cssnext: {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,5 @@ | ||
| let path = require('path'); | ||
| const webpackConfig = require('../config/webpack/development'); | ||
|
|
||
| module.exports = { | ||
| module: { | ||
| rules: [ | ||
| { | ||
| test: /\.js$/, | ||
| exclude: /node_modules/, | ||
| loader: 'babel-loader', | ||
| options: { | ||
| presets: [ | ||
| path.join(__dirname, '..', 'node_modules/babel-preset-react'), | ||
| path.join(__dirname, '..', 'node_modules/babel-preset-env') | ||
| ], | ||
| plugins: [ | ||
| path.join(__dirname, '..', 'node_modules/babel-plugin-transform-class-properties'), | ||
| path.join(__dirname, '..', 'node_modules/babel-plugin-transform-object-rest-spread'), | ||
| path.join(__dirname, '..', 'node_modules/babel-plugin-transform-object-assign') | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| test: /\.css$/, | ||
| loaders: ['style-loader', 'css-loader'] | ||
| }, | ||
| { | ||
| test: /(\.png|\.gif)$/, | ||
| loader: 'url-loader?limit=32767' | ||
| }, | ||
| { | ||
| test: /\.scss$/, | ||
| loaders: ['style-loader', 'css-loader', 'sass-loader'] | ||
| } | ||
| ] | ||
| } | ||
| module: webpackConfig.module, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,15 @@ | ||
| # Run Rails & Webpack concurrently | ||
| # If you wish to use a different server then the default, use e.g. `export RAILS_STARTUP='puma -w 3 -p 3000 --preload'` | ||
| # If you wish to use a different server then the default, use e.g. | ||
| # `export RAILS_STARTUP='puma -w 3 -p 3000 --preload'` | ||
| # OR | ||
| # RAILS_STARTUP='puma -w 3 -p 3000 --preload' foreman start | ||
| rails: [ -n "$RAILS_STARTUP" ] && env PRY_WARNING=1 $RAILS_STARTUP || [ -n "$BIND" ] && bin/rails server -b $BIND || env PRY_WARNING=1 bin/rails server | ||
| # you can use WEBPACK_OPTS to customize webpack server, e.g. 'WEBPACK_OPTS='--https --key /path/to/key --cert /path/to/cert.pem --cacert /path/to/cacert.pem' foreman start ' | ||
| webpack: ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js $WEBPACK_OPTS | ||
|
|
||
| # you can use environment variables as options supported by webpack-dev-server | ||
| # in the form WEBPACKER_DEV_SERVER_<OPTION>, e.g. | ||
| # WEBPACKER_DEV_SERVER_HTTPS=true \ | ||
| # WEBPACKER_DEV_SERVER_KEY=/path/to/key \ | ||
| # WEBPACKER_DEV_SERVER_CERT=/path/to/cert.pem \ | ||
| # WEBPACKER_DEV_SERVER_CACERT=/path/to/cacert.pem \ | ||
| # foreman start | ||
| webpack: ./bin/webpack-dev-server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| import 'javascripts/bundle'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/usr/bin/env ruby | ||
| # frozen_string_literal: true | ||
| # | ||
| # This file was generated by Bundler. | ||
| # | ||
| # The application 'webpack' is installed as part of a gem, and | ||
| # this file is here to facilitate running it. | ||
| # | ||
|
|
||
| require "pathname" | ||
| ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", | ||
| Pathname.new(__FILE__).realpath) | ||
|
|
||
| require "rubygems" | ||
| require "bundler/setup" | ||
|
|
||
| load Gem.bin_path("webpacker", "webpack") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/usr/bin/env ruby | ||
| # frozen_string_literal: true | ||
| # | ||
| # This file was generated by Bundler. | ||
| # | ||
| # The application 'webpack-dev-server' is installed as part of a gem, and | ||
| # this file is here to facilitate running it. | ||
| # | ||
|
|
||
| require "pathname" | ||
| ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", | ||
| Pathname.new(__FILE__).realpath) | ||
|
|
||
| require "rubygems" | ||
| require "bundler/setup" | ||
|
|
||
| load Gem.bin_path("webpacker", "webpack-dev-server") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we changing the defaults? are those webpacker defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!