質問編集履歴
1
ビルド環境で関係ありそうな部分を追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,6 +76,88 @@
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
+
# ビルド環境
|
80
|
+
|
81
|
+
package.json
|
82
|
+
|
83
|
+
```json
|
84
|
+
|
85
|
+
{
|
86
|
+
|
87
|
+
"dependencies": {
|
88
|
+
|
89
|
+
"react": "^16.8.6",
|
90
|
+
|
91
|
+
"react-dom": "^16.8.6",
|
92
|
+
|
93
|
+
},
|
94
|
+
|
95
|
+
"devDependencies": {
|
96
|
+
|
97
|
+
"react-svg-loader": "^3.0.3",
|
98
|
+
|
99
|
+
"ts-loader": "^5.3.3",
|
100
|
+
|
101
|
+
"typescript": "^3.4.1",
|
102
|
+
|
103
|
+
"webpack": "^4.29.6",
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
webpack.js
|
114
|
+
|
115
|
+
```javascript
|
116
|
+
|
117
|
+
module.exports = {
|
118
|
+
|
119
|
+
module: {
|
120
|
+
|
121
|
+
rules: [
|
122
|
+
|
123
|
+
{
|
124
|
+
|
125
|
+
test: /.tsx?$/,
|
126
|
+
|
127
|
+
use: {
|
128
|
+
|
129
|
+
loader: "ts-loader",
|
130
|
+
|
131
|
+
options: {
|
132
|
+
|
133
|
+
transpileOnly: true
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
},
|
138
|
+
|
139
|
+
exclude: /node_modules/
|
140
|
+
|
141
|
+
},
|
142
|
+
|
143
|
+
{
|
144
|
+
|
145
|
+
test: /.svg$/,
|
146
|
+
|
147
|
+
use: ["react-svg-loader"]
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
]
|
152
|
+
|
153
|
+
},
|
154
|
+
|
155
|
+
};
|
156
|
+
|
157
|
+
```
|
158
|
+
|
159
|
+
|
160
|
+
|
79
161
|
# その他補足
|
80
162
|
|
81
163
|
`const SVG = React.lazy(() => import(src));`の行で直接パスを書くと正常に動作します。
|