質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
へ
|
68
68
|
|
69
|
-
```
|
69
|
+
```javascript
|
70
70
|
|
71
71
|
require("jquery")
|
72
72
|
|
@@ -78,6 +78,52 @@
|
|
78
78
|
|
79
79
|
|
80
80
|
|
81
|
+
#### 回答に応答する追記
|
82
|
+
|
83
|
+
`config/webpack/environment.js`を次のように変更
|
84
|
+
|
85
|
+
```javascript
|
86
|
+
|
87
|
+
const { environment } = require('@rails/webpacker')
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
const webpack = require('webpack')
|
92
|
+
|
93
|
+
environment.plugins.prepend('Provide',
|
94
|
+
|
95
|
+
new webpack.ProvidePlugin({
|
96
|
+
|
97
|
+
$: 'jquery/src/jquery',
|
98
|
+
|
99
|
+
jQuery: 'jquery/src/jquery',
|
100
|
+
|
101
|
+
Popper: ['popper.js', 'default'],
|
102
|
+
|
103
|
+
Toastr: 'toastr'
|
104
|
+
|
105
|
+
})
|
106
|
+
|
107
|
+
)
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
module.exports = environment
|
112
|
+
|
113
|
+
```
|
114
|
+
|
115
|
+
`./app/javascript/packs/application.js`を次のように追記
|
116
|
+
|
117
|
+
```javascript
|
118
|
+
|
119
|
+
import toastr from 'toastr';
|
120
|
+
|
121
|
+
window.toastr = toastr;
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
|
126
|
+
|
81
127
|
### 補足情報(FW/ツールのバージョンなど)
|
82
128
|
|
83
129
|
|