質問編集履歴

1

webpack.config.jsに前に試したコードを貼り付けていました, 申し訳ないです.

2021/08/28 19:00

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -100,52 +100,64 @@
100
100
 
101
101
  module.exports = {
102
102
 
103
+ entry: {
104
+
103
- entry: "./src/js/main.js",
105
+ app: "./src/index.js"
106
+
107
+ },
104
108
 
105
109
  output: {
106
110
 
107
- path:__dirname+ '/dist/',
111
+ path: __dirname + '/public/js',
108
112
 
109
- filename: "bundle.js",
113
+ filename: "[name].js"
110
-
111
- publicPath: '/'
112
114
 
113
115
  },
114
116
 
115
- devServer: {
117
+ devServer: {
116
118
 
117
- inline: false,
119
+ contentBase: __dirname + '/public',
118
120
 
121
+ port: 8080,
122
+
119
- contentBase: "./dist",
123
+ publicPath: '/js/'
120
124
 
121
125
  },
122
126
 
127
+ devtool: "eval-source-map",
128
+
129
+ mode: 'development',
130
+
123
131
  module: {
124
132
 
125
- loaders: [
133
+ rules: [{
126
134
 
127
- {
135
+ test: /.js$/,
128
136
 
129
- test: /.jsx?$/,
137
+ enforce: "pre",
130
138
 
131
- exclude:/(node_modules|bower_components)/,
139
+ exclude: /node_modules/,
132
140
 
133
- loader: 'babel-loader',
141
+ loader: "eslint-loader"
134
142
 
135
- query: {
143
+ }, {
136
144
 
137
- presets: ['es2015', 'react']
145
+ test: /.css$/,
138
146
 
139
- }
147
+ loader: ["style-loader","css-loader"]
140
148
 
141
- }
149
+ }, {
142
150
 
151
+ test: /.js$/,
152
+
153
+ exclude: /node_modules/,
154
+
155
+ loader: 'babel-loader'
156
+
143
- ]
157
+ }]
144
158
 
145
159
  }
146
160
 
147
-
148
-
149
- };
161
+ };
150
162
 
151
163
  ```