質問編集履歴

4

rm

2022/03/03 04:18

投稿

sk-sora--ypi
sk-sora--ypi

スコア528

test CHANGED
File without changes
test CHANGED
@@ -174,10 +174,6 @@
174
174
  },
175
175
  }
176
176
  ```
177
-
178
- [今回のリポジトリ](https://github.com/sinsky/my-prod)
179
-
180
-
181
177
  ### 試したこと
182
178
  最初は`ts-loader`のみでやっていましたが今回のエラーが発生。
183
179
  色々検索していく中でbabelを使うと解決...のような文言を見た気がしましたので、

3

リポジトリの追加

2022/03/03 01:52

投稿

sk-sora--ypi
sk-sora--ypi

スコア528

test CHANGED
File without changes
test CHANGED
@@ -8,24 +8,24 @@
8
8
 
9
9
  ```shell
10
10
  $ yarn build:prod
11
+ yarn run v1.22.17
11
- $ webpack --mode=production --node-env=production
12
+ $ webpack --mode=production --node-env=production && node client.js.Addtag.js
12
- assets by status 169 KiB [cached] 1 asset
13
+ assets by status 152 KiB [cached] 1 asset
13
- orphan modules 452 KiB [orphan] 12 modules
14
+ orphan modules 449 KiB [orphan] 10 modules
14
15
  runtime modules 663 bytes 3 modules
15
- cacheable modules 618 KiB
16
- modules by path ./node_modules/ 155 KiB
16
+ modules by path ./node_modules/ 155 KiB
17
- modules by path ./node_modules/style-loader/dist/runtime/*.js 5.75 KiB 6 modules
17
+ modules by path ./node_modules/style-loader/dist/runtime/*.js 5.75 KiB 6 modules
18
- modules by path ./node_modules/react/ 6.48 KiB 2 modules
18
+ modules by path ./node_modules/react/ 6.48 KiB 2 modules
19
- modules by path ./node_modules/react-dom/ 119 KiB 2 modules
19
+ modules by path ./node_modules/react-dom/ 119 KiB 2 modules
20
- modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
20
+ modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
21
- modules by path ./node_modules/css-loader/dist/runtime/*.js 2.33 KiB 2 modules
21
+ modules by path ./node_modules/css-loader/dist/runtime/*.js 2.33 KiB 2 modules
22
- ./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
22
+ ./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
23
- ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/react-toastify/dist/ReactToastify.css 14.7 KiB [built] [code generated]
23
+ ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/react-toastify/dist/ReactToastify.css 14.7 KiB [built] [code generated]
24
- modules by path ./src/ 462 KiB
24
+ modules by path ./src/ 458 KiB
25
- ./src/script.tsx + 12 modules 452 KiB [built] [code generated]
25
+ ./src/script.tsx + 10 modules 449 KiB [built] [code generated]
26
- ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./src/css/output.css 9.65 KiB [built] [code generated]
26
+ ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./src/css/output.css 9.26 KiB [built] [code generated]
27
27
 
28
- ERROR in ./src/script.tsx + 12 modules
28
+ ERROR in ./src/script.tsx + 10 modules
29
29
  Line 6993: Unexpected token ...
30
30
  while analyzing module /Users/user/Desktop/my-prod/node_modules/chart.js/dist/chart.esm.js for concatenation
31
31
  Error: Line 6993: Unexpected token ...
@@ -40,7 +40,7 @@
40
40
  at Parser.parsePrimaryExpression (/Users/user/Desktop/my-prod/node_modules/esprima/dist/esprima.js:2354:38)
41
41
  at Parser.inheritCoverGrammar (/Users/user/Desktop/my-prod/node_modules/esprima/dist/esprima.js:2285:37)
42
42
 
43
- webpack 5.69.1 compiled with 1 error in 3541 ms
43
+ webpack 5.69.1 compiled with 1 error in 6252 ms
44
44
  error Command failed with exit code 1.
45
45
  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
46
46
  ```
@@ -48,6 +48,7 @@
48
48
  ### 該当のソースコード
49
49
 
50
50
  ```JavaScript:webpack.config.js
51
+ // Generated using webpack-cli https://github.com/webpack/webpack-cli
51
52
  const path = require("path");
52
53
  const GasPlugin = require("gas-webpack-plugin");
53
54
 
@@ -55,7 +56,7 @@
55
56
 
56
57
  const config = {
57
58
  entry: {
58
- script: "./src/script.tsx",
59
+ client: "./src/script.tsx",
59
60
  },
60
61
  devtool: false,
61
62
  output: {
@@ -108,9 +109,16 @@
108
109
  "name": "my-prod",
109
110
  "version": "1.0.0",
110
111
  "description": "",
111
- "main": "./src/index.ts",
112
+ "main": "./src/script.ts",
112
113
  "scripts": {
114
+ "build": "npm-run-all --serial delete:file build:css build:prod move:file",
115
+ "push": "clasp push",
116
+ "delete:file": "rimraf -g dist/*.{js,html}",
117
+ "move:file": "cpx \"src/**/*.html\" dist",
118
+ "build:dev": "webpack --mode=development && node client.js.Addtag.js",
113
- "build:prod": "webpack --mode=production --node-env=production"
119
+ "build:prod": "webpack --mode=production --node-env=production && node client.js.Addtag.js",
120
+ "build:css": "tailwindcss -i ./src/css/input.css -o ./src/css/output.css",
121
+ "watch": "webpack --watch"
114
122
  },
115
123
  "keywords": [],
116
124
  "license": "ISC",
@@ -166,6 +174,10 @@
166
174
  },
167
175
  }
168
176
  ```
177
+
178
+ [今回のリポジトリ](https://github.com/sinsky/my-prod)
179
+
180
+
169
181
  ### 試したこと
170
182
  最初は`ts-loader`のみでやっていましたが今回のエラーが発生。
171
183
  色々検索していく中でbabelを使うと解決...のような文言を見た気がしましたので、

2

package.jsonの修正

2022/03/03 01:22

投稿

sk-sora--ypi
sk-sora--ypi

スコア528

test CHANGED
File without changes
test CHANGED
@@ -110,7 +110,7 @@
110
110
  "description": "",
111
111
  "main": "./src/index.ts",
112
112
  "scripts": {
113
- "build:prod": "webpack --mode=production --node-env=production && node
113
+ "build:prod": "webpack --mode=production --node-env=production"
114
114
  },
115
115
  "keywords": [],
116
116
  "license": "ISC",

1

初心者マークの追加

2022/03/03 01:13

投稿

sk-sora--ypi
sk-sora--ypi

スコア528

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  ### 前提・実現したいこと
4
2
  `react-chartjs-2`を使ってグラフを出そうとしたところ、
5
3
  webpackでbuildした際にエラーが出ます。