質問編集履歴

1

タスクを実行するjavascriptファイルを追加しました。

2018/05/05 04:44

投稿

Saggitarie
Saggitarie

スコア9

test CHANGED
File without changes
test CHANGED
@@ -440,6 +440,8 @@
440
440
 
441
441
 
442
442
 
443
+
444
+
443
445
  <!-- Optional JavaScript -->
444
446
 
445
447
  <!-- jQuery first, then Popper.js, then Bootstrap JS -->
@@ -462,6 +464,182 @@
462
464
 
463
465
 
464
466
 
467
+ webpack.config.babel.js
468
+
469
+
470
+
471
+ ```Javascript
472
+
473
+ import path from 'path';
474
+
475
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
476
+
477
+
478
+
479
+ const PUBLIC_DIR = path.resolve(__dirname, "dest");
480
+
481
+
482
+
483
+ export default {
484
+
485
+ mode: 'production',
486
+
487
+ entry: './src/info.js',
488
+
489
+ output: {
490
+
491
+ path: PUBLIC_DIR,
492
+
493
+ filename: 'index.bundle.js'
494
+
495
+ },
496
+
497
+ module: {
498
+
499
+ rules: [
500
+
501
+ {
502
+
503
+ test: /.js$/,
504
+
505
+ exclude: /node_modules/,
506
+
507
+ use: {
508
+
509
+ loader: 'babel-loader',
510
+
511
+ options: {
512
+
513
+ presets: ['react']
514
+
515
+ }
516
+
517
+ }
518
+
519
+ }
520
+
521
+ ]
522
+
523
+ },
524
+
525
+ plugins: [
526
+
527
+ new HtmlWebpackPlugin({
528
+
529
+ template: './src/index.html',
530
+
531
+ filename: './index.html'
532
+
533
+ })
534
+
535
+ ]
536
+
537
+ };
538
+
539
+
540
+
541
+ ```
542
+
543
+ package.json
544
+
545
+ ```Json
546
+
547
+ {
548
+
549
+ "name": "javascript-todo",
550
+
551
+ "version": "1.0.0",
552
+
553
+ "description": "",
554
+
555
+ "main": "index.js",
556
+
557
+ "scripts": {
558
+
559
+ "build": "webpack",
560
+
561
+ "test": "jest"
562
+
563
+ },
564
+
565
+ "repository": {
566
+
567
+ "type": "git",
568
+
569
+ "url": "https://net2018-gitlab.casareal.co.jp/samples/testing-javascript.git"
570
+
571
+ },
572
+
573
+ "keywords": [],
574
+
575
+ "author": "",
576
+
577
+ "license": "ISC",
578
+
579
+ "devDependencies": {
580
+
581
+ "babel-core": "^6.26.0",
582
+
583
+ "babel-loader": "^7.1.4",
584
+
585
+ "babel-preset-env": "^1.6.1",
586
+
587
+ "babel-preset-react": "^6.24.1",
588
+
589
+ "html-loader": "^0.5.5",
590
+
591
+ "html-webpack-plugin": "^3.2.0",
592
+
593
+ "jest": "^22.4.3",
594
+
595
+ "webpack": "^4.6.0",
596
+
597
+ "webpack-cli": "^2.0.14"
598
+
599
+ }
600
+
601
+ }
602
+
603
+
604
+
605
+ ```
606
+
607
+
608
+
609
+ BMI_Test.iml
610
+
611
+ ```IML
612
+
613
+ <?xml version="1.0" encoding="UTF-8"?>
614
+
615
+ <module type="WEB_MODULE" version="4">
616
+
617
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
618
+
619
+ <exclude-output />
620
+
621
+ <content url="file://$MODULE_DIR$" />
622
+
623
+ <orderEntry type="sourceFolder" forTests="false" />
624
+
625
+ </component>
626
+
627
+ </module>
628
+
629
+ ```
630
+
631
+
632
+
633
+ ```Javascript
634
+
635
+ {
636
+
637
+ "presets": ["env", "react"]
638
+
639
+ }
640
+
641
+ ```
642
+
465
643
  ### 試したこと
466
644
 
467
645