Repository navigation
Expand file tree
/
Copy pathwebpack.config.common.js
More file actions
118 lines (116 loc) · 2.74 KB
/
Copy pathwebpack.config.common.js
File metadata and controls
118 lines (116 loc) · 2.74 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
'use strict';
const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
module.exports = {
entry: {
index: './src/index.js',
},
module: {
rules: [
{
test: /\.vue$/,
use: 'vue-loader'
},
{
test: /\.js$/,
use: 'babel-loader'
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
data: `
@import "Scss/_mixins.scss";
`
}
}
]
},
{
test: /\.(js|vue)$/,
use: 'eslint-loader',
enforce: 'pre'
},
{
test: /\.(png|PNG|svg|jpg|gif)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[path][name].[ext]'
}
}
]
}
]
},
resolve: {
alias: {
Image: path.resolve(__dirname, 'static/img'),
Component: path.resolve(__dirname, 'src/components'),
Services: path.resolve(__dirname, 'src/services'),
Data: path.resolve(__dirname, 'src/data'),
Class: path.resolve(__dirname, 'src/class'),
Asset: path.resolve(__dirname, 'assets'),
Src: path.resolve(__dirname, 'src'),
Mixin: path.resolve(__dirname, 'src/mixin'),
Scss: path.resolve(__dirname, 'src/scss')
}
},
plugins: [
new HtmlWebpackPlugin({
title: 'Interface de recherche',
chunks: ['index', 'vue', 'lodash'],
filename: 'index.html',
template: 'index.html',
inject: true
}),
new CleanWebpackPlugin(),
new VueLoaderPlugin(),
new CopyWebpackPlugin([{
from: path.resolve(__dirname, 'static/img'),
to: path.resolve(__dirname, 'dist/static/img'),
toType: 'dir'
}]),
new StyleLintPlugin({
configFile: '.stylelintrc',
context: 'src',
files: ['**/*.{vue,css,scss}'],
failOnError: false,
quiet: false
})
],
optimization: {
splitChunks: {
cacheGroups: {
vue: {
reuseExistingChunk: true,
test: /[\\/]node_modules[\\/]vue/,
name: 'vue',
chunks: 'all'
},
lodash: {
reuseExistingChunk: true,
test: /[\\/]node_modules[\\/]lodash-es/,
name: 'lodash',
chunks: 'all'
}
}
}
}
};