webpacker 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +1 -1
- data/docs/typescript.md +45 -8
- data/lib/install/typescript.rb +1 -4
- data/lib/webpacker/helper.rb +4 -4
- data/lib/webpacker/version.rb +1 -1
- data/package.json +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 120db32ca99baa277a5452ed1c68cc0fa842e60aac86214f7329e2979b0d81ea
|
4
|
+
data.tar.gz: 47c5eef5ff70a8436523b776e595e59269cac206e7b88e2f37bf4716a944f9d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 784c1ad63862030eac771b060a82fbec37a73513f0cc82f2b08e13e0687a32ab673dcfb550bc73f22be420035a66cf39fb8425458e6660500758108875f2fe8f
|
7
|
+
data.tar.gz: b52f0a2ac48b0fcfb07900d800976bcc2b8f99b46ad8109f7283088584d456b0f1f0129a7d5b1028060128cb7dcc04927ac2b98da965963e0a29adf626868b7a
|
data/CHANGELOG.md
CHANGED
@@ -2,10 +2,15 @@
|
|
2
2
|
|
3
3
|
**Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
|
4
4
|
|
5
|
+
## [[5.1.1]](https://github.com/rails/webpacker/compare/v5.1.0...v5.1.1) - 2020-04-20
|
6
|
+
|
7
|
+
- Update [TypeScript documentation](https://github.com/rails/webpacker/blob/master/docs/typescript.md) and installer to use babel-loader for typescript.[(#2541](https://github.com/rails/webpacker/pull/2541)
|
8
|
+
|
5
9
|
## [[5.1.0]](https://github.com/rails/webpacker/compare/v5.0.1...v5.1.0) - 2020-04-19
|
6
10
|
|
7
11
|
- Remove yarn integrity check [#2518](https://github.com/rails/webpacker/pull/2518)
|
8
|
-
- Switch from ts-loader to babel-loader [#2449](https://github.com/rails/webpacker/pull/2449)
|
12
|
+
- Switch from ts-loader to babel-loader [#2449](https://github.com/rails/webpacker/pull/2449)
|
13
|
+
Please see the [TypeScript documentation](https://github.com/rails/webpacker/blob/master/docs/typescript.md) to upgrade existing projects to use typescript with 5.1
|
9
14
|
- Resolve multi-word snakecase WEBPACKER_DEV_SERVER env values [#2528](https://github.com/rails/webpacker/pull/2528)
|
10
15
|
|
11
16
|
## [[5.0.1]](https://github.com/rails/webpacker/compare/v5.0.0...v5.0.1) - 2020-03-22
|
data/Gemfile.lock
CHANGED
data/docs/typescript.md
CHANGED
@@ -1,18 +1,54 @@
|
|
1
|
-
#
|
1
|
+
# TypeScript
|
2
2
|
|
3
|
+
## Installation
|
3
4
|
|
4
|
-
|
5
|
+
1. Run the TypeScript installer
|
5
6
|
|
6
|
-
|
7
|
+
```bash
|
8
|
+
bundle exec rails webpacker:install:typescript
|
9
|
+
```
|
10
|
+
|
11
|
+
After that, a new file called `hello_typescript.ts` will be present in your `packs` directory (or rather the `source_entry_path` of your `webpacker.yml` configuration). You're now ready to write TypeScript.
|
12
|
+
|
13
|
+
## Upgrading to 5.1
|
14
|
+
|
15
|
+
If you update your App to `webpacker >= 5.1` and had TypeScript installed before, you need to add some new/remove some old configurations:
|
16
|
+
|
17
|
+
1. Remove old packages:
|
18
|
+
- `yarn remove ts-loader`
|
19
|
+
|
20
|
+
2. Add new packages:
|
21
|
+
- `yarn add @babel/preset-typescript`
|
22
|
+
|
23
|
+
3. Remove old configuration files:
|
24
|
+
- Delete this file: `config/webpack/loaders/typescript.js`
|
25
|
+
|
26
|
+
4. Remove the following lines from `config/webpack/environment.js`:
|
27
|
+
- `const typescript = require('./loaders/typescript')`
|
28
|
+
- `environment.loaders.prepend('typescript', typescript)`
|
29
|
+
|
30
|
+
5. Add the TypeScript preset to your `babel.config.js`:
|
31
|
+
- This line `['@babel/preset-typescript', { 'allExtensions': true, 'isTSX': true }]` has to be added as the last item to the `presets` array in your `babel.config.js`
|
32
|
+
|
33
|
+
### Upgrading to 5.1 for Vue users
|
34
|
+
|
35
|
+
1. Remove old packages:
|
36
|
+
- `yarn remove ts-loader pnp-webpack-plugin`
|
37
|
+
|
38
|
+
2. Follow point 3 and 4 from the `TypeScript with Vue components` section
|
39
|
+
|
40
|
+
## TypeScript with React
|
41
|
+
|
42
|
+
1. Setup react using Webpacker [react installer](../README.md#react). Then run the TypeScript installer
|
7
43
|
|
8
44
|
```bash
|
9
45
|
bundle exec rails webpacker:install:typescript
|
10
46
|
```
|
11
47
|
|
12
|
-
2. Rename the generated `hello_react.js` to `hello_react.tsx`. Make the file valid
|
13
|
-
now you can use
|
48
|
+
2. Rename the generated `hello_react.js` to `hello_react.tsx`. Make the file valid TypeScript and
|
49
|
+
now you can use TypeScript, JSX with React.
|
14
50
|
|
15
|
-
##
|
51
|
+
## TypeScript with Vue components
|
16
52
|
|
17
53
|
1. Setup Vue using the Webpacker [Vue installer](../README.md#vue). Then run the TypeScript installer
|
18
54
|
|
@@ -21,7 +57,8 @@ bundle exec rails webpacker:install:typescript
|
|
21
57
|
```
|
22
58
|
|
23
59
|
2. Rename generated `hello_vue.js` to `hello_vue.ts`.
|
24
|
-
3.
|
60
|
+
3. Install the right Babel preset: `yarn add babel-preset-typescript-vue`
|
61
|
+
4. Change the generated `babel.config.js` from
|
25
62
|
|
26
63
|
```js
|
27
64
|
["@babel/preset-typescript", { "allExtensions": true, "isTSX": true }]
|
@@ -35,7 +72,7 @@ to
|
|
35
72
|
|
36
73
|
and now you can use `<script lang="ts">` in your `.vue` component files. See [the babel-preset-typescript-vue docs](https://www.npmjs.com/package/babel-preset-typescript-vue) for more info.
|
37
74
|
|
38
|
-
## HTML templates with
|
75
|
+
## HTML templates with TypeScript and Angular
|
39
76
|
|
40
77
|
After you have installed Angular using `bundle exec rails webpacker:install:angular`
|
41
78
|
you would need to follow these steps to add HTML templates support:
|
data/lib/install/typescript.rb
CHANGED
@@ -34,9 +34,6 @@ copy_file "#{__dir__}/examples/typescript/hello_typescript.ts",
|
|
34
34
|
"#{Webpacker.config.source_entry_path}/hello_typescript.ts"
|
35
35
|
|
36
36
|
say "Installing all typescript dependencies"
|
37
|
-
run "yarn add typescript #{additional_packages}"
|
38
|
-
|
39
|
-
say "Installing all typescript dev-dependencies"
|
40
|
-
run "yarn add @babel/preset-typescript babel-preset-typescript-vue -D"
|
37
|
+
run "yarn add typescript @babel/preset-typescript #{additional_packages}"
|
41
38
|
|
42
39
|
say "Webpacker now supports typescript 🎉", :green
|
data/lib/webpacker/helper.rb
CHANGED
@@ -61,7 +61,7 @@ module Webpacker::Helper
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# Creates a script tag that references the named pack file, as compiled by webpack per the entries list
|
64
|
-
# in
|
64
|
+
# in package/environments/base.js. By default, this list is auto-generated to match everything in
|
65
65
|
# app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
|
66
66
|
#
|
67
67
|
# Example:
|
@@ -73,7 +73,7 @@ module Webpacker::Helper
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# Creates script tags that reference the js chunks from entrypoints when using split chunks API,
|
76
|
-
# as compiled by webpack per the entries list in
|
76
|
+
# as compiled by webpack per the entries list in package/environments/base.js.
|
77
77
|
# By default, this list is auto-generated to match everything in
|
78
78
|
# app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
|
79
79
|
# See: https://webpack.js.org/plugins/split-chunks-plugin/
|
@@ -110,7 +110,7 @@ module Webpacker::Helper
|
|
110
110
|
end
|
111
111
|
|
112
112
|
# Creates a link tag that references the named pack file, as compiled by webpack per the entries list
|
113
|
-
# in
|
113
|
+
# in package/environments/base.js. By default, this list is auto-generated to match everything in
|
114
114
|
# app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
|
115
115
|
#
|
116
116
|
# Note: If the development server is running and hot module replacement is active, this will return nothing.
|
@@ -132,7 +132,7 @@ module Webpacker::Helper
|
|
132
132
|
end
|
133
133
|
|
134
134
|
# Creates link tags that reference the css chunks from entrypoints when using split chunks API,
|
135
|
-
# as compiled by webpack per the entries list in
|
135
|
+
# as compiled by webpack per the entries list in package/environments/base.js.
|
136
136
|
# By default, this list is auto-generated to match everything in
|
137
137
|
# app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
|
138
138
|
# See: https://webpack.js.org/plugins/split-chunks-plugin/
|
data/lib/webpacker/version.rb
CHANGED
data/package.json
CHANGED
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: 5.1.
|
4
|
+
version: 5.1.1
|
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: 2020-04-
|
12
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -300,8 +300,8 @@ homepage: https://github.com/rails/webpacker
|
|
300
300
|
licenses:
|
301
301
|
- MIT
|
302
302
|
metadata:
|
303
|
-
source_code_uri: https://github.com/rails/webpacker/tree/v5.1.
|
304
|
-
changelog_uri: https://github.com/rails/webpacker/blob/v5.1.
|
303
|
+
source_code_uri: https://github.com/rails/webpacker/tree/v5.1.1
|
304
|
+
changelog_uri: https://github.com/rails/webpacker/blob/v5.1.1/CHANGELOG.md
|
305
305
|
post_install_message:
|
306
306
|
rdoc_options: []
|
307
307
|
require_paths:
|