質問編集履歴
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -32,12 +32,35 @@
|
|
32
32
|
の後に
|
33
33
|
`./app/javascript/packs/application.js`
|
34
34
|
へ
|
35
|
-
```
|
35
|
+
```javascript
|
36
36
|
require("jquery")
|
37
37
|
require("toastr")
|
38
38
|
```
|
39
39
|
を追加してます
|
40
40
|
|
41
|
+
#### 回答に応答する追記
|
42
|
+
`config/webpack/environment.js`を次のように変更
|
43
|
+
```javascript
|
44
|
+
const { environment } = require('@rails/webpacker')
|
45
|
+
|
46
|
+
const webpack = require('webpack')
|
47
|
+
environment.plugins.prepend('Provide',
|
48
|
+
new webpack.ProvidePlugin({
|
49
|
+
$: 'jquery/src/jquery',
|
50
|
+
jQuery: 'jquery/src/jquery',
|
51
|
+
Popper: ['popper.js', 'default'],
|
52
|
+
Toastr: 'toastr'
|
53
|
+
})
|
54
|
+
)
|
55
|
+
|
56
|
+
module.exports = environment
|
57
|
+
```
|
58
|
+
`./app/javascript/packs/application.js`を次のように追記
|
59
|
+
```javascript
|
60
|
+
import toastr from 'toastr';
|
61
|
+
window.toastr = toastr;
|
62
|
+
```
|
63
|
+
|
41
64
|
### 補足情報(FW/ツールのバージョンなど)
|
42
65
|
|
43
66
|
ruby on rails 6 (on Docker)
|