-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
91 lines (89 loc) · 2.06 KB
/
webpack.common.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const path = require('path')
const webpack = require('webpack')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const ESLintPlugin = require('eslint-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const distPath = path.resolve(__dirname, 'public')
module.exports = {
entry: {
main: './src/main.js',
},
output: {
filename: '[name]-[contenthash].js',
path: distPath,
assetModuleFilename: 'images/[name][ext][query]',
},
plugins: [
new webpack.DefinePlugin({
GOOGLE_API_KEY: JSON.stringify(process.env.GOOGLE_API_KEY),
}),
new CleanWebpackPlugin({
verbose: true,
}),
new VueLoaderPlugin(),
new ESLintPlugin({
extensions: ['js', 'vue'],
}),
new CopyPlugin({
patterns: [{ from: 'src/robots.txt', to: 'robots.txt' }],
}),
],
module: {
rules: [
{
test: /\.vue$/,
exclude: /node_modules/,
loader: 'vue-loader',
},
{
test: /\.js$/,
exclude: /node_modules/,
include: '/node_modules/vuetify',
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: ['last 2 version', 'not dead'],
modules: false,
useBuiltIns: 'usage',
corejs: 3,
},
],
],
},
},
{
test: /\.(ico|svg|jpe?g|png|webp)$/,
type: 'asset/resource',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.s(a|c)ss$/,
use: [
'style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
implementation: require('sass'),
sassOptions: {
indentedSyntax: true,
},
},
},
],
},
],
},
resolve: {
alias: {
vue: 'vue/dist/vue.min.js',
},
},
}