質問編集履歴

4

追記

2021/12/23 04:42

投稿

tttniaeefe
tttniaeefe

スコア13

test CHANGED
File without changes
test CHANGED
@@ -379,3 +379,39 @@
379
379
  }
380
380
 
381
381
  ```
382
+
383
+ dist配下のhtml
384
+
385
+ ```indexhtml
386
+
387
+ <!DOCTYPE html>
388
+
389
+ <html lang="jp">
390
+
391
+
392
+
393
+ <head>
394
+
395
+ <meta charset="UTF-8" />
396
+
397
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
398
+
399
+ <title>memo-map</title>
400
+
401
+ <script defer src="bundle.js"></script></head> ⇐**ビルド時に追加されている**
402
+
403
+
404
+
405
+ <body>
406
+
407
+ <div id="container"></div>
408
+
409
+ <script src="bundle.js"></script>
410
+
411
+ </body>
412
+
413
+
414
+
415
+ </html>
416
+
417
+ ```

3

追記

2021/12/23 04:42

投稿

tttniaeefe
tttniaeefe

スコア13

test CHANGED
File without changes
test CHANGED
@@ -291,3 +291,91 @@
291
291
 
292
292
 
293
293
  ```
294
+
295
+
296
+
297
+ ```packagejson
298
+
299
+ {
300
+
301
+ "name": "test",
302
+
303
+ "version": "0.0.0",
304
+
305
+ "main": "index.js",
306
+
307
+ "license": "NOLICENCED",
308
+
309
+ "dependencies": {
310
+
311
+ "@material-ui/core": "^4.12.3",
312
+
313
+ "@material-ui/icons": "^4.11.2",
314
+
315
+ "eslint-config-prettier": "^8.3.0",
316
+
317
+ "eslint-plugin-prettier": "^4.0.0",
318
+
319
+ "react": "^17.0.2",
320
+
321
+ "react-dom": "^17.0.2",
322
+
323
+ "react-router-dom": "^6.2.1",
324
+
325
+ "styled-components": "^5.3.3"
326
+
327
+ },
328
+
329
+ "devDependencies": {
330
+
331
+ "@types/react": "^17.0.37",
332
+
333
+ "@types/react-dom": "^17.0.11",
334
+
335
+ "@types/react-router-dom": "^5.3.2",
336
+
337
+ "@types/styled-components": "^5.1.18",
338
+
339
+ "@typescript-eslint/eslint-plugin": "^5.8.0",
340
+
341
+ "@typescript-eslint/parser": "^5.8.0",
342
+
343
+ "clean-webpack-plugin": "^4.0.0",
344
+
345
+ "eslint": "^7.32.0",
346
+
347
+ "eslint-config-standard": "^16.0.3",
348
+
349
+ "eslint-plugin-import": "^2.25.3",
350
+
351
+ "eslint-plugin-node": "^11.1.0",
352
+
353
+ "eslint-plugin-promise": "^5.2.0",
354
+
355
+ "eslint-plugin-react": "^7.27.1",
356
+
357
+ "html-webpack-plugin": "^5.5.0",
358
+
359
+ "prettier": "^2.5.1",
360
+
361
+ "ts-loader": "^9.2.6",
362
+
363
+ "typescript": "^4.5.4",
364
+
365
+ "webpack": "^5.65.0",
366
+
367
+ "webpack-cli": "^4.9.1",
368
+
369
+ "webpack-dev-server": "^4.7.0"
370
+
371
+ },
372
+
373
+ "scripts": {
374
+
375
+ "start": "yarn webpack-dev-server"
376
+
377
+ }
378
+
379
+ }
380
+
381
+ ```

2

追記

2021/12/23 02:40

投稿

tttniaeefe
tttniaeefe

スコア13

test CHANGED
File without changes
test CHANGED
@@ -85,3 +85,209 @@
85
85
  <button>clickMe</button>
86
86
 
87
87
  ```
88
+
89
+
90
+
91
+
92
+
93
+ ### 補足情報(FW/ツールのバージョンなど)
94
+
95
+
96
+
97
+ 構築手順
98
+
99
+
100
+
101
+ nodeインストール(v16)
102
+
103
+
104
+
105
+ --パッケージの初期化--------------------------------------------
106
+
107
+ yarn init
108
+
109
+
110
+
111
+ --パッケージのインストール--------------------------------------------
112
+
113
+ 1 yarn add react
114
+
115
+ 2 yarn add react-dom
116
+
117
+ 3 yarn add react-router-dom
118
+
119
+ 4 yarn add styled-components
120
+
121
+ 5 yarn add -D typescript
122
+
123
+ 6 yarn add -D webpack
124
+
125
+ 7 yarn add -D webpack webpack-cli ts-loader
126
+
127
+ 8 yarn add -D eslint
128
+
129
+ 9 yarn add -D prettier
130
+
131
+ 10 yarn add -D @types/react
132
+
133
+ 11 yarn add -D @types/react-dom
134
+
135
+ 12 yarn add -D @types/react-router-dom
136
+
137
+ 13 yarn add -D @types/styled-components
138
+
139
+
140
+
141
+ --typescriptの設定--------------------------------------------
142
+
143
+ 14 yarn tsc --init
144
+
145
+
146
+
147
+ --eslint,prettierの設定--------------------------------------------
148
+
149
+ 15 yarn eslint --init
150
+
151
+ 16 yarn add eslint-config-prettier
152
+
153
+ 17 yarn add eslint-plugin-prettier
154
+
155
+
156
+
157
+ --ビルド--------------------------------------------
158
+
159
+ 18 yarn webpack
160
+
161
+
162
+
163
+ ※resourcesフォルダ配下にindex.htmlを作成しておく
164
+
165
+ --ビルドの自動化--------------------------------------------
166
+
167
+ 19 yarn add -D clean-webpack-plugin html-webpack-plugin
168
+
169
+
170
+
171
+ --開発環境サーバを導入--------------------------------------------
172
+
173
+  20 yarn add -D webpack-dev-server
174
+
175
+ 21 yarn webpack-dev-server
176
+
177
+
178
+
179
+ ```webpack
180
+
181
+ const path = require('path');
182
+
183
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
184
+
185
+
186
+
187
+ module.exports = {
188
+
189
+ mode: 'development',
190
+
191
+ entry: './src/index.tsx',
192
+
193
+ output: {
194
+
195
+ filename: 'bundle.js',
196
+
197
+ path: path.resolve(__dirname, 'dist'),
198
+
199
+ },
200
+
201
+ module: {
202
+
203
+ rules: [
204
+
205
+ {
206
+
207
+ test: /.tsx?$/,
208
+
209
+ use: 'ts-loader',
210
+
211
+ },
212
+
213
+ ],
214
+
215
+ },
216
+
217
+ resolve: {
218
+
219
+ extensions: ['.ts', '.tsx', '.js', '.jsx'],
220
+
221
+ },
222
+
223
+ devtool: 'eval-source-map',
224
+
225
+ plugins: [
226
+
227
+ new HtmlWebpackPlugin({
228
+
229
+ template: 'resources/index.html',
230
+
231
+ }),
232
+
233
+ ],
234
+
235
+ devServer: {
236
+
237
+ static: path.join(__dirname, 'dist'),
238
+
239
+ compress: true,
240
+
241
+ historyApiFallback: true,
242
+
243
+ open: true,
244
+
245
+ port: 8080,
246
+
247
+ },
248
+
249
+ };
250
+
251
+
252
+
253
+ ```
254
+
255
+
256
+
257
+ ```tsconfig
258
+
259
+ {
260
+
261
+ "compilerOptions": {
262
+
263
+ "target": "es5",
264
+
265
+ "lib": [
266
+
267
+ "DOM",
268
+
269
+ "ES2019"
270
+
271
+ ],
272
+
273
+ "jsx": "react",
274
+
275
+ "module": "commonjs",
276
+
277
+ "esModuleInterop": true,
278
+
279
+ "forceConsistentCasingInFileNames": true,
280
+
281
+ "strict": true,
282
+
283
+ "skipLibCheck": true,
284
+
285
+ },
286
+
287
+ "files": ["src/index.tsx"]
288
+
289
+ }
290
+
291
+
292
+
293
+ ```

1

誤字

2021/12/23 02:34

投稿

tttniaeefe
tttniaeefe

スコア13

test CHANGED
@@ -1 +1 @@
1
- buttonタグの中にonClickイベント表示させたい
1
+ buttonタグの中にonClickイベント表示させたい
test CHANGED
File without changes