質問編集履歴
2
webpack.config.jsの内容追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -215,3 +215,175 @@
|
|
215
215
|
2020/11/04 追記
|
216
216
|
|
217
217
|
node.jsのバージョンはv12.18.3です。
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
webpackにてbuildを行っております。
|
222
|
+
|
223
|
+
以下にwebpack.config.jsの内容を追記します。
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
webpack.config.js
|
228
|
+
|
229
|
+
```javascript
|
230
|
+
|
231
|
+
var path = require('path')
|
232
|
+
|
233
|
+
var webpack = require('webpack')
|
234
|
+
|
235
|
+
const ExtractTextPlugin = require("extract-text-webpack-plugin")
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
module.exports = {
|
240
|
+
|
241
|
+
entry: './src/main.js',
|
242
|
+
|
243
|
+
output: {
|
244
|
+
|
245
|
+
path: path.resolve(__dirname, './dist'),
|
246
|
+
|
247
|
+
publicPath: '/dist/',
|
248
|
+
|
249
|
+
filename: 'build.js'
|
250
|
+
|
251
|
+
},
|
252
|
+
|
253
|
+
module: {
|
254
|
+
|
255
|
+
rules: [
|
256
|
+
|
257
|
+
{
|
258
|
+
|
259
|
+
test: /.vue$/,
|
260
|
+
|
261
|
+
loader: 'vue-loader',
|
262
|
+
|
263
|
+
options: {
|
264
|
+
|
265
|
+
loaders: {
|
266
|
+
|
267
|
+
}
|
268
|
+
|
269
|
+
// other vue-loader options go here
|
270
|
+
|
271
|
+
}
|
272
|
+
|
273
|
+
},
|
274
|
+
|
275
|
+
{
|
276
|
+
|
277
|
+
test: /.js$/,
|
278
|
+
|
279
|
+
loader: 'babel-loader',
|
280
|
+
|
281
|
+
exclude: /node_modules/
|
282
|
+
|
283
|
+
},
|
284
|
+
|
285
|
+
{
|
286
|
+
|
287
|
+
test: /.css$/,
|
288
|
+
|
289
|
+
use: ExtractTextPlugin.extract({
|
290
|
+
|
291
|
+
fallback: "style-loader",
|
292
|
+
|
293
|
+
use: "css-loader"
|
294
|
+
|
295
|
+
})
|
296
|
+
|
297
|
+
},
|
298
|
+
|
299
|
+
{
|
300
|
+
|
301
|
+
test: /.(png|jpg|gif|svg)$/,
|
302
|
+
|
303
|
+
loader: 'file-loader',
|
304
|
+
|
305
|
+
options: {
|
306
|
+
|
307
|
+
name: '[name].[ext]?[hash]'
|
308
|
+
|
309
|
+
}
|
310
|
+
|
311
|
+
}
|
312
|
+
|
313
|
+
]
|
314
|
+
|
315
|
+
},
|
316
|
+
|
317
|
+
resolve: {
|
318
|
+
|
319
|
+
alias: {
|
320
|
+
|
321
|
+
'vue$': 'vue/dist/vue.esm.js'
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
},
|
326
|
+
|
327
|
+
devServer: {
|
328
|
+
|
329
|
+
historyApiFallback: true,
|
330
|
+
|
331
|
+
noInfo: true
|
332
|
+
|
333
|
+
},
|
334
|
+
|
335
|
+
performance: {
|
336
|
+
|
337
|
+
hints: false
|
338
|
+
|
339
|
+
},
|
340
|
+
|
341
|
+
plugins: [new ExtractTextPlugin("main.css")],
|
342
|
+
|
343
|
+
devtool: '#eval-source-map'
|
344
|
+
|
345
|
+
}
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
if (process.env.NODE_ENV === 'production') {
|
350
|
+
|
351
|
+
module.exports.devtool = '#source-map'
|
352
|
+
|
353
|
+
// http://vue-loader.vuejs.org/en/workflow/production.html
|
354
|
+
|
355
|
+
module.exports.plugins = (module.exports.plugins || []).concat([
|
356
|
+
|
357
|
+
new webpack.DefinePlugin({
|
358
|
+
|
359
|
+
'process.env': {
|
360
|
+
|
361
|
+
NODE_ENV: '"production"'
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
}),
|
366
|
+
|
367
|
+
new webpack.optimize.UglifyJsPlugin({
|
368
|
+
|
369
|
+
sourceMap: true,
|
370
|
+
|
371
|
+
compress: {
|
372
|
+
|
373
|
+
warnings: false
|
374
|
+
|
375
|
+
}
|
376
|
+
|
377
|
+
}),
|
378
|
+
|
379
|
+
new webpack.LoaderOptionsPlugin({
|
380
|
+
|
381
|
+
minimize: true
|
382
|
+
|
383
|
+
})
|
384
|
+
|
385
|
+
])
|
386
|
+
|
387
|
+
}
|
388
|
+
|
389
|
+
```
|
1
node.jsのバージョン情報を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -209,3 +209,9 @@
|
|
209
209
|
"babel-preset-env": "^1.6.1"
|
210
210
|
|
211
211
|
"cross-env": "^5.1.1"
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
2020/11/04 追記
|
216
|
+
|
217
|
+
node.jsのバージョンはv12.18.3です。
|