質問編集履歴

5

OS情報を追加

2020/04/07 09:39

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -268,7 +268,7 @@
268
268
 
269
269
  ```
270
270
 
271
-
271
+ Windowsで実施
272
272
 
273
273
  Node.jsのバージョン:
274
274
 

4

ソースコードを変更

2020/04/07 09:39

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -42,7 +42,7 @@
42
42
 
43
43
  entry: {
44
44
 
45
- app: './src/ts/setup.ts',
45
+ app: './src/ts/index.ts',
46
46
 
47
47
  },
48
48
 

3

ソースコードを変更

2020/04/03 06:43

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -28,19 +28,21 @@
28
28
 
29
29
  ■webpack.config.js
30
30
 
31
-
32
-
33
- const path = require('path');
31
+ const path = require("path");
34
-
32
+
35
- const webpack = require('webpack');
33
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
34
+
35
+
36
36
 
37
37
  module.exports = {
38
38
 
39
39
  mode: "development",
40
40
 
41
+
42
+
41
43
  entry: {
42
44
 
43
- app: './src/ts/index.ts',
45
+ app: './src/ts/setup.ts',
44
46
 
45
47
  },
46
48
 
@@ -54,59 +56,61 @@
54
56
 
55
57
  },
56
58
 
59
+ module: {
60
+
61
+ rules: [{
62
+
63
+ test: /.ts$/,
64
+
65
+ use: "ts-loader"
66
+
67
+ }]
68
+
69
+ },
70
+
71
+ optimization: {
72
+
73
+ splitChunks: {
74
+
75
+ cacheGroups: {
76
+
77
+ vendor: {
78
+
79
+ test: /node_modules/,
80
+
81
+ name: 'vendor',
82
+
83
+ chunks: 'initial',
84
+
85
+ enforce: true
86
+
87
+ }
88
+
89
+ },
90
+
91
+
92
+
93
+ }
94
+
95
+ },
96
+
57
97
  resolve: {
58
98
 
59
- extensions: ['.js', '.ts'],
99
+ extensions: [".ts", ".js"]
60
-
61
- modules: [path.resolve(__dirname, 'src'), 'node_modules']
100
+
62
-
63
- },
101
+ },
64
-
65
- optimization: {
102
+
66
-
67
- splitChunks: {
68
-
69
- cacheGroups: {
70
-
71
- vendor: {
103
+ devServer: {
104
+
72
-
105
+ disableHostCheck: true,
106
+
73
- test: /node_modules/,
107
+ contentBase: path.join(__dirname, "dist/"),
74
-
108
+
75
- name: 'vendor',
109
+ compress: true,
76
-
110
+
77
- chunks: 'initial',
111
+ port: 8080,
78
-
112
+
79
- enforce: true
113
+ open: true
80
-
81
- }
82
-
83
- }
84
-
85
- }
86
-
87
- },
88
-
89
- module: {
90
-
91
- rules: [{
92
-
93
- test: /.ts$/,
94
-
95
- exclude: /node_modules/,
96
-
97
- loader: 'ts-loader',
98
-
99
- },
100
-
101
- {
102
-
103
- test: require.resolve('snapsvg/dist/snap.svg.js'),
104
-
105
- use: 'imports-loader?this=>window,fix=>module.exports=0',
106
-
107
- }
108
-
109
- ]
110
114
 
111
115
  },
112
116
 
@@ -114,319 +118,153 @@
114
118
 
115
119
  plugins: [
116
120
 
117
- new webpack.optimize.OccurrenceOrderPlugin(),
121
+ new HtmlWebpackPlugin({
122
+
118
-
123
+ template: "src/index.html"
124
+
125
+ })
126
+
127
+ ]
128
+
129
+ };
130
+
131
+ ```
132
+
133
+ ```json
134
+
135
+ ■tsconfig.json
136
+
137
+ {
138
+
139
+ "compilerOptions": {
140
+
141
+ "target": "es5",
142
+
143
+ "module": "CommonJS",
144
+
145
+ "lib": ["dom", "es5"],
146
+
147
+ "baseUrl": "./src/ts",
148
+
149
+ "outDir": "./dist/js",
150
+
151
+ "allowJs": true,
152
+
153
+ "alwaysStrict": true,
154
+
155
+ "esModuleInterop": true,
156
+
119
- new webpack.optimize.AggressiveMergingPlugin(),
157
+ "forceConsistentCasingInFileNames": true,
158
+
159
+ "isolatedModules": true,
160
+
161
+ "moduleResolution": "node",
162
+
163
+ "noEmit": false,
164
+
165
+ "noFallthroughCasesInSwitch": true,
166
+
167
+ "noUnusedLocals": false,
168
+
169
+ "noUnusedParameters": false,
170
+
171
+ "removeComments": true,
172
+
173
+ "skipLibCheck": true,
174
+
175
+ "strict": true,
176
+
177
+ "noImplicitAny": false,
178
+
179
+ "strictNullChecks": false
180
+
181
+ },
182
+
183
+ "compileOnSave": true,
184
+
185
+ "include": [
186
+
187
+ "src/ts/**/*.ts"
120
188
 
121
189
  ],
122
190
 
191
+ "exclude": [
192
+
193
+ "node_modules",
194
+
195
+ ],
196
+
197
+ }
198
+
199
+ ```
200
+
201
+ ```json
202
+
123
- devServer: {
203
+ ■package.json
204
+
124
-
205
+ {
206
+
207
+ "name": "sample",
208
+
209
+ "version": "1.0.0",
210
+
211
+ "description": "",
212
+
213
+ "main": "index.js",
214
+
215
+ "scripts": {
216
+
217
+ "test": "echo \"Error: no test specified\" && exit 1",
218
+
219
+ "build": "webpack",
220
+
221
+ "start": "webpack-dev-server"
222
+
223
+ },
224
+
225
+ "author": "",
226
+
227
+ "license": "ISC",
228
+
229
+ "dependencies": {
230
+
231
+ "pixi.js": "^5.2.1"
232
+
233
+ },
234
+
235
+ "devDependencies": {
236
+
237
+ "html-loader": "^1.1.0",
238
+
125
- contentBase: path.join(__dirname, 'dist/'),
239
+ "html-webpack-plugin": "^4.0.4",
240
+
126
-
241
+ "ts-loader": "^6.2.2",
242
+
127
- compress: true,
243
+ "typescript": "^3.8.3",
128
-
129
- port: 8080,
244
+
130
-
131
- open: true,
245
+ "webpack": "^4.42.1",
246
+
247
+ "webpack-cli": "^3.3.11",
248
+
249
+ "webpack-dev-server": "^3.10.3"
132
250
 
133
251
  }
134
252
 
135
- };
136
-
137
- ```
138
-
139
- ```json
140
-
141
- ■tsconfig.json
142
-
143
-
144
-
145
- {
146
-
147
- "compilerOptions": {
148
-
149
- "target": "es5",
150
-
151
- "module": "CommonJS",
152
-
153
- "lib": ["dom", "es5"],
154
-
155
- "baseUrl": "./src/ts",
156
-
157
- "outDir": "./dist/js",
158
-
159
- "sourceMap": false,
160
-
161
- "allowJs": true,
162
-
163
- "alwaysStrict": true,
164
-
165
- "esModuleInterop": true,
166
-
167
- "forceConsistentCasingInFileNames": true,
168
-
169
- "isolatedModules": true,
170
-
171
- "moduleResolution": "node",
172
-
173
- "noEmit": false,
174
-
175
- "noFallthroughCasesInSwitch": true,
176
-
177
- "noUnusedLocals": false,
178
-
179
- "noUnusedParameters": false,
180
-
181
- "removeComments": true,
182
-
183
- "skipLibCheck": true,
184
-
185
- "strict": true,
186
-
187
- "noImplicitAny": false,
188
-
189
- "strictNullChecks": false
190
-
191
- },
192
-
193
- "compileOnSave": true,
194
-
195
- "include": [
196
-
197
- "src/ts/**/*.ts"
198
-
199
- ],
200
-
201
- "exclude": [
202
-
203
- "node_modules",
204
-
205
- ],
206
-
207
253
  }
208
254
 
209
255
  ```
210
256
 
211
- ```
212
-
213
- ■.babelrc
214
-
215
-
216
-
217
- {
218
-
219
- "presets": [
220
-
221
- ["@babel/preset-env", {
222
-
223
- "modules": false
224
-
225
- }]
226
-
227
- ],
228
-
229
- "env": {
230
-
231
- "test": {
232
-
233
- "presets": [
234
-
235
- ["env", {
236
-
237
- "targets": {
238
-
239
- "node": "current"
240
-
241
- }
242
-
243
- }]
244
-
245
- ]
246
-
247
- }
248
-
249
- }
250
-
251
- }
252
-
253
- ```
254
-
255
- ```json
256
-
257
- ■package.json
258
-
259
-
260
-
261
- {
262
-
263
- "name": "sample",
264
-
265
- "version": "1.0.0",
266
-
267
- "description": "sample",
268
-
269
- "main": "index.js",
270
-
271
- "scripts": {
272
-
273
- "test": "jest",
274
-
275
- },
276
-
277
- "jest": {
278
-
279
- "moduleFileExtensions": [
280
-
281
- "ts",
282
-
283
- "tsx",
284
-
285
- "js"
286
-
287
- ],
288
-
289
- "transform": {
290
-
291
- "^.+\.(ts|tsx)$": "ts-jest"
292
-
293
- },
294
-
295
- "globals": {
296
-
297
- "ts-jest": {
298
-
299
- "tsConfigFile": "tsconfig.json"
300
-
301
- }
302
-
303
- },
304
-
305
- "testMatch": [
306
-
307
- "**/test/*.+(ts|tsx|js)"
308
-
309
- ]
310
-
311
- },
312
-
313
- "author": "",
314
-
315
- "license": "ISC",
316
-
317
- "devDependencies": {
318
-
319
- "@babel/core": "^7.6.2",
320
-
321
- "@babel/preset-env": "^7.6.2",
322
-
323
- "@types/jest": "^25.1.3",
324
-
325
- "@typescript-eslint/eslint-plugin": "^2.25.0",
326
-
327
- "@typescript-eslint/parser": "^2.25.0",
328
-
329
- "babel-core": "^7.0.0-bridge.0",
330
-
331
- "babel-jest": "^24.9.0",
332
-
333
- "babel-loader": "^8.0.6",
334
-
335
- "babel-preset-env": "^1.7.0",
336
-
337
- "browser-sync": "^2.26.7",
338
-
339
- "eslint": "^6.8.0",
340
-
341
- "eslint-config-prettier": "^6.10.1",
342
-
343
- "eslint-plugin-prettier": "^3.1.2",
344
-
345
- "express": "^4.17.1",
346
-
347
- "gulp": "^4.0.2",
348
-
349
- "gulp-babel": "^8.0.0",
350
-
351
- "html-webpack-plugin": "^3.2.0",
352
-
353
- "imports-loader": "^0.8.0",
354
-
355
- "jest": "^24.9.0",
356
-
357
- "jest-useragent-mock": "0.0.3",
358
-
359
- "prettier": "^2.0.2",
360
-
361
- "ts-jest": "^25.2.1",
362
-
363
- "ts-loader": "^6.2.1",
364
-
365
- "typescript": "^3.8.2",
366
-
367
- "webpack": "^4.41.0",
368
-
369
- "webpack-cdn-plugin": "^3.2.2",
370
-
371
- "webpack-dev-server": "^3.8.2",
372
-
373
- "webpack-stream": "^5.2.1"
374
-
375
- },
376
-
377
- "dependencies": {
378
-
379
- "pixi.js": "^5.2.1"
380
-
381
- }
382
-
383
- }
384
-
385
- ```
386
-
387
-
388
-
389
- ```javascript
390
-
391
- ■gulpfile.js
392
-
393
- const gulp = require('gulp');
394
-
395
- const webpackStream = require("webpack-stream");
396
-
397
- const webpack = require("webpack");
398
-
399
- const webpackConfig = require("./webpack.config");
400
-
401
-
402
-
403
- gulp.task('bundle', () => {
404
-
405
- return webpackStream(webpackConfig, webpack)
406
-
407
- .pipe(gulp.dest('./dist/js'));
408
-
409
- });
410
-
411
-
412
-
413
- gulp.task('default', gulp.parallel('bundle'));
414
-
415
- ```
416
-
417
257
 
418
258
 
419
259
  ```typescript
420
260
 
421
261
  ■index.ts
422
262
 
423
-
424
-
425
263
  import * as PIXI from "pixi.js";
426
264
 
427
265
  const loader: PIXI.Loader = PIXI.Loader.shared;
428
266
 
429
- loader.load((loader: PIXI.Loader, resources: Partial<Record<string, PIXI.LoaderResource>>) => {alert("load!");});
267
+ alert("load!");
430
268
 
431
269
  ```
432
270
 

2

Node.jsのバージョン情報を追加

2020/04/03 06:13

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -429,3 +429,13 @@
429
429
  loader.load((loader: PIXI.Loader, resources: Partial<Record<string, PIXI.LoaderResource>>) => {alert("load!");});
430
430
 
431
431
  ```
432
+
433
+
434
+
435
+ Node.jsのバージョン:
436
+
437
+ v.10.10.0
438
+
439
+ npmのバージョン:
440
+
441
+ 6.4.1

1

ソースコードの追加

2020/04/02 03:06

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -376,22 +376,56 @@
376
376
 
377
377
  "dependencies": {
378
378
 
379
- "@types/snapsvg": "^0.5.0",
380
-
381
- "axios": "^0.19.2",
382
-
383
- "pixi-layers": "^0.2.3",
384
-
385
- "pixi-projection": "^0.3.5",
386
-
387
- "pixi.js": "^5.2.1",
379
+ "pixi.js": "^5.2.1"
388
-
389
- "snapsvg": "^0.5.1",
390
-
391
- "snapsvg-cjs": "0.0.6"
392
380
 
393
381
  }
394
382
 
395
383
  }
396
384
 
397
385
  ```
386
+
387
+
388
+
389
+ ```javascript
390
+
391
+ ■gulpfile.js
392
+
393
+ const gulp = require('gulp');
394
+
395
+ const webpackStream = require("webpack-stream");
396
+
397
+ const webpack = require("webpack");
398
+
399
+ const webpackConfig = require("./webpack.config");
400
+
401
+
402
+
403
+ gulp.task('bundle', () => {
404
+
405
+ return webpackStream(webpackConfig, webpack)
406
+
407
+ .pipe(gulp.dest('./dist/js'));
408
+
409
+ });
410
+
411
+
412
+
413
+ gulp.task('default', gulp.parallel('bundle'));
414
+
415
+ ```
416
+
417
+
418
+
419
+ ```typescript
420
+
421
+ ■index.ts
422
+
423
+
424
+
425
+ import * as PIXI from "pixi.js";
426
+
427
+ const loader: PIXI.Loader = PIXI.Loader.shared;
428
+
429
+ loader.load((loader: PIXI.Loader, resources: Partial<Record<string, PIXI.LoaderResource>>) => {alert("load!");});
430
+
431
+ ```