webpacker 4.0.0.rc.8 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaad344f0471e623fde0e00f3444f63f08b2347fa50171309dd20d429dc3e680
4
- data.tar.gz: 21a1b84e25560f25565ee2670ae0654c74fb8a7ef48ecf953ffb245ceff77b08
3
+ metadata.gz: 2a7805a2d44a354561df073afad34d94737462e6d3caeaa3a10a6a7d8af68696
4
+ data.tar.gz: ae0fa6adff258760562a647b4f3da733f1201bb97bbe96ef1778e1b8293a630e
5
5
  SHA512:
6
- metadata.gz: 34e2f71eea35056a09af3b285e43747bf273722f5cbabc4b5643bed6d4a53cba0ed9fa25f7397a864325a1147748b1365ddab433b04a16b2289a7ac9b050c50d
7
- data.tar.gz: 0ecb39cbc1e5c98d2095c7b4066ef097e4b60f057f065d3f1add3f76a36074d2f40449ecc695dc44c8f9ee71c7b9c2181e27636a4ca35a557d7dec05cb0f1962
6
+ metadata.gz: 8fe0fc1c396fab1124d17682a024b1834cf57f064b7438785ac3ac452988b49dc37d9ce3c353b30ccdb187b2576399ae4a9bcc6bdf71e0758c2ac3e38914700b
7
+ data.tar.gz: f68ec7f83d40ad66c6fd585fc9e11a50a7c1c632610f1f8d2944872f5caeda30778be38132dc818a09530d3095c10ae5ab8cd35f569998085425ea8c648ac6af
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  **Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
2
2
 
3
+ ## [4.0.0] - 2019-03-04
4
+
5
+ No changes in this release. See RC releases for changes.
6
+
7
+
3
8
  ## [4.0.0.rc.8] - 2019-03-03
4
9
 
5
10
  ### Fixed
@@ -178,7 +183,7 @@ helper otherwise you will get duplicated chunks on the page.
178
183
  - Separate rule to compile node modules
179
184
  (fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
180
185
 
181
- In previous versions only application code was transpiled. Now everything in `node_modules` transpiled with Babel. In some cases it could break your build (known issue with `mapbox-gl` package being broken by Babel, https://github.com/mapbox/mapbox-gl-js/issues/3422).
186
+ In previous versions only application code was transpiled. Now everything in `node_modules` is transpiled with Babel. In some cases it could break your build (known issue with `mapbox-gl` package being broken by Babel, https://github.com/mapbox/mapbox-gl-js/issues/3422).
182
187
 
183
188
  [`nodeModules` loader](https://github.com/rails/webpacker/pull/1823/files#diff-456094c8451b5774db50028dfecf4aa8) ignores `config.babel.js` and uses hard-coded `'@babel/preset-env', { modules: false }` config.
184
189
 
data/Gemfile.lock CHANGED
@@ -15,7 +15,7 @@ GIT
15
15
  PATH
16
16
  remote: .
17
17
  specs:
18
- webpacker (4.0.0.rc.8)
18
+ webpacker (4.0.0)
19
19
  activesupport (>= 4.2)
20
20
  rack-proxy (>= 0.6.1)
21
21
  railties (>= 4.2)
data/README.md CHANGED
@@ -13,7 +13,7 @@ even JavaScript Sprinkles (that all continues to live in app/assets).
13
13
  However, it is possible to use Webpacker for CSS, images and fonts assets as well,
14
14
  in which case you may not even need the asset pipeline. This is mostly relevant when exclusively using component-based JavaScript frameworks.
15
15
 
16
- **NOTE:** The master branch now hosts the code for v4.x.x. Please refer to [3-x-stable](https://github.com/rails/webpacker/tree/3-x-stable) branch for 3.x documentation.
16
+ **NOTE:** The master branch now hosts the code for v4.x.x. Please refer to [3-x-stable](https://github.com/rails/webpacker/tree/3-x-stable) branch for 3.x documentation. See the [v4-upgrade guide](docs/v4-upgrade.md) for an overview of the changes.
17
17
 
18
18
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
19
19
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
data/docs/v4-upgrade.md CHANGED
@@ -1,19 +1,27 @@
1
+ # Webpacker Upgrade Guide
2
+
3
+
1
4
  To update a Webpacker v3.5 app to v4, follow these steps:
2
5
 
3
- 1. Update the `webpacker` gem and the `@rails/webpacker` package to v4. This will upgrade webpack itself from 3.x to 4.x, make sure you're aware of [any deprecations which might effect you](https://webpack.js.org/migrate/4/). Also make sure any other packages you depend on support webpack 4 and don't require any changes, e.g. if you explicitly include `webpack` you need to upgrade it to 4.x, and if you use `webpack-dev-server` you need to upgrade it to 3.x.
4
- 1. Browser support definitions have been moved to [`.browserslistrc`](../lib/install/config/.browserslistrc) to `/`.
5
- 1. Merge any differences between [`config/webpacker.yml`](../lib/install/config/webpacker.yml) and your `config/webpacker.yml`.
6
- 1. Webpacker v4 upgrades Babel to [v7](https://babeljs.io/docs/en/v7-migration), see also [the release blog post](https://babeljs.io/blog/2018/08/27/7.0.0). Many packages were moved to the `@babel/` namespace, any babel plugins you have will need to be updated. It may be worth checking out [babel-upgrade](https://github.com/babel/babel-upgrade) if you have problems. ([#1564](https://github.com/rails/webpacker/pull/1564))
7
- 1. `.babelrc` should be replaced with `babel.config.js` and `.postcssrc.yml` should be replaced with `postcss.config.js` ([#1822](https://github.com/rails/webpacker/pull/1822)). If you never changed these files from their defaults, the versions of [babel.config.js](../lib/install/config/babel.config.js) and [postcss.config.js](../lib/install/config/postcss.config.js) in the webpacker repository should be usable.
8
- 1. Due to the change in [#1625](https://github.com/rails/webpacker/pull/1625), you'll want to make sure that `extract_css` is set to true for the `default` environment in `webpacker.yml` if you want to have Webpacker supply your CSS.
6
+ 1. Update the `webpacker` gem and the `@rails/webpacker` package to v4. This will upgrade Webpack itself from 3.x to 4.x, make sure you're aware of [any deprecations which might effect you](https://webpack.js.org/migrate/4/). Also make sure any other packages you depend on support Webpack 4 and don't require any changes, e.g. if you explicitly include `webpack` you need to upgrade it to 4.x, and if you use `webpack-dev-server` you need to upgrade it to 3.x.
7
+
8
+ 2. Browser support definitions have been moved to [`.browserslistrc`](../lib/install/config/.browserslistrc) to `/`.
9
+
10
+ 3. Merge any differences between [`config/webpacker.yml`](../lib/install/config/webpacker.yml) and your `config/webpacker.yml`.
11
+
12
+ 4. Webpacker v4 upgrades Babel to [v7](https://babeljs.io/docs/en/v7-migration), see also [the release blog post](https://babeljs.io/blog/2018/08/27/7.0.0). Many packages were moved to the `@babel/` namespace, any babel plugins you have will need to be updated. It may be worth checking out [babel-upgrade](https://github.com/babel/babel-upgrade) if you have problems. ([#1564](https://github.com/rails/webpacker/pull/1564))
13
+
14
+ 5. `.babelrc` should be replaced with `babel.config.js` and `.postcssrc.yml` should be replaced with `postcss.config.js` ([#1822](https://github.com/rails/webpacker/pull/1822)). If you never changed these files from their defaults, the versions of [babel.config.js](../lib/install/config/babel.config.js) and [postcss.config.js](../lib/install/config/postcss.config.js) in the webpacker repository should be usable.
15
+
16
+ 6. Due to the change in [#1625](https://github.com/rails/webpacker/pull/1625), you'll want to make sure that `extract_css` is set to true for the `default` environment in `webpacker.yml` if you want to have Webpacker supply your CSS.
9
17
 
10
- ### Add SplitChunks
18
+ ## SplitChunks Configuration
11
19
 
12
20
  If you used the `CommonsChunkPlugin` you'll need to upgrade to using the new `splitChunks`.
13
21
 
14
- Originally, chunks (and modules imported inside them) were connected by a parent-child relationship in the internal webpack graph. The `CommonsChunkPlugin` was used to avoid duplicated dependencies across them, but further optimizations were not possible.
22
+ Originally, chunks (and modules imported inside them) were connected by a parent-child relationship in the internal Webpack graph. The `CommonsChunkPlugin` was used to avoid duplicated dependencies across them, but further optimizations were not possible.
15
23
 
16
- In webpack v4, `CommonsChunkPlugin` was removed in favor of `optimization.splitChunks`.
24
+ In Webpack v4, the `CommonsChunkPlugin` was removed in favor of `optimization.splitChunks`.
17
25
 
18
26
  For the full configuration options of `splitChunks`, see the [Webpack documentation](https://webpack.js.org/plugins/split-chunks-plugin/).
19
27
 
@@ -28,13 +36,13 @@ environment.splitChunks()
28
36
  environment.splitChunks((config) => Object.assign({}, config, { optimization: { splitChunks: false }}))
29
37
  ```
30
38
 
31
- Then use, `javascript_packs_with_chunks_tag` helper to include all the transpiled
39
+ Then use the `javascript_packs_with_chunks_tag` and `stylesheet_packs_with_chunks_tag` helpers to include all the transpiled
32
40
  packs with the chunks in your view, which creates html tags for all the chunks.
33
41
 
34
42
  ```erb
35
43
  <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
36
44
 
37
- <!-- would create the following: -->
45
+ <!-- Creates the following: -->
38
46
  <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
39
47
  <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
40
48
  <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
@@ -42,8 +50,7 @@ packs with the chunks in your view, which creates html tags for all the chunks.
42
50
  <script src="/packs/map-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
43
51
  ```
44
52
 
45
- **Important:** Pass all your pack names when using this helper otherwise you will
46
- get duplicated chunks on the page.
53
+ **Important:** Pass all your pack names to the helper otherwise you will get duplicated chunks on the page.
47
54
 
48
55
  ```erb
49
56
  <%# DO %>
@@ -54,17 +61,17 @@ get duplicated chunks on the page.
54
61
  <%= javascript_packs_with_chunks_tag 'map' %>
55
62
  ```
56
63
 
57
- ### Package-specific notes:
64
+ ## Package-Specific Notes
58
65
 
59
66
  - If you're using React, you need to add `"@babel/preset-react"`, to the list of `presets` in your babel config.
60
- - If you're using Vue Loader, you'll need to upgrade to [v15](https://vue-loader.vuejs.org/migrating.html) for webpack 4.
61
- - To see what webpacker generates for a given framework with v4, you may want to re-run `bundle exec rake webpacker:install:FRAMEWORK` and let it override the files for your given JavaScript framework, and then compare them to see what changes you'll need to make.
67
+ - If you're using Vue Loader, you'll need to upgrade to [v15](https://vue-loader.vuejs.org/migrating.html) for Webpack 4.
68
+ - To see what Webpacker generates for a given framework with v4, you may want to re-run `bundle exec rake webpacker:install:FRAMEWORK` and let it override the files for your given JavaScript framework, and then compare them to see what changes you'll need to make.
62
69
 
63
- ### Excluding node_modules from being transpiled by babel-loader
70
+ ## Excluding node_modules From Being Transpiled By Babel-Loader
64
71
 
65
72
  One change to take into consideration, is that Webpacker 4 transpiles the
66
73
  `node_modules` folder with the `babel-loader`. This folder used to be ignored by
67
- webpacker 3. The new behavior helps in case some library contains ES6 code, but in
74
+ Webpacker 3. The new behavior helps in case some library contains ES6 code, but in
68
75
  some cases it can lead to issues. To avoid running `babel-loader` in the
69
76
  `node_modules` folder, replicating the same behavior as Webpacker 3, the
70
77
  following code can be added to `config/webpack/environment.js`:
@@ -87,7 +94,7 @@ nodeModulesLoader.exclude.push(/some-library/) // replace `some-library` with
87
94
  // the actual path to exclude
88
95
  ```
89
96
 
90
- ### Source Maps are enabled by default
97
+ ## Source Maps Enabled By Default
91
98
 
92
99
  Source maps are now enabled in production to make debugging in production easier. Enabling source maps doesn't have drawbacks for most of the applications since maps are compressed by default and aren't loaded by browsers unless Dev Tools are opened.
93
100
 
@@ -102,7 +109,23 @@ environment.config.merge({ devtool: 'none' })
102
109
  module.exports = environment.toWebpackConfig()
103
110
  ```
104
111
 
105
- ### Example upgrades
112
+ ## Namespaces
113
+
114
+ The compiled packs in the public directory are now stored under namespaces:
115
+
116
+ - JavaScripts are stored under `js`
117
+ - Stylesheets are stored under `css`
118
+ - Other resources are stored under `media`
119
+
120
+ ```rb
121
+ # Before
122
+ "runtime~hello_react" => "/packs/runtime~hello_react-da2baf7fd07b0e8b6d17.js"
123
+
124
+ # After
125
+ "runtime~hello_react" => "/packs/js/runtime~hello_react-da2baf7fd07b0e8b6d17.js"
126
+ ```
127
+
128
+ ## Example Upgrades
106
129
 
107
130
  This is what an upgrade to Webpacker 4 looked like for existing Rails apps (please contribute yours!):
108
131
 
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "4.0.0.rc.8".freeze
3
+ VERSION = "4.0.0".freeze
4
4
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rails/webpacker",
3
- "version": "4.0.0-rc.8",
3
+ "version": "4.0.0",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "main": "package/index.js",
6
6
  "files": [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc.8
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-03 00:00:00.000000000 Z
12
+ date: 2019-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -253,8 +253,8 @@ homepage: https://github.com/rails/webpacker
253
253
  licenses:
254
254
  - MIT
255
255
  metadata:
256
- source_code_uri: https://github.com/rails/webpacker/tree/v4.0.0.rc.8
257
- changelog_uri: https://github.com/rails/webpacker/blob/v4.0.0.rc.8/CHANGELOG.md
256
+ source_code_uri: https://github.com/rails/webpacker/tree/v4.0.0
257
+ changelog_uri: https://github.com/rails/webpacker/blob/v4.0.0/CHANGELOG.md
258
258
  post_install_message:
259
259
  rdoc_options: []
260
260
  require_paths:
@@ -266,9 +266,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
266
  version: 2.2.0
267
267
  required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - ">"
269
+ - - ">="
270
270
  - !ruby/object:Gem::Version
271
- version: 1.3.1
271
+ version: '0'
272
272
  requirements: []
273
273
  rubyforge_project:
274
274
  rubygems_version: 2.7.6