-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
93 lines (92 loc) · 2.24 KB
/
Copy pathwebpack.config.js
File metadata and controls
93 lines (92 loc) · 2.24 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
const path = require('path');
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
const { VueLoaderPlugin } = require('vue-loader')
const webpack = require('webpack')
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: {
main: ['./src/scss/theme.scss', './src/js/main.js'],
polyfill: '@babel/polyfill',
},
output: {
path: path.resolve(__dirname, 'source')
},
plugins: [
new VueLoaderPlugin(),
new MiniCSSExtractPlugin({
filename: 'css/theme.css'
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
GENERATED_JSON_PATH: 'phpvigo.json'
},
})
],
resolve: {
extensions: [ '.js', '.vue' ],
alias: {
'vue$': process.env.NODE_ENV === 'production' ? 'vue/dist/vue.runtime.min.js' : 'vue/dist/vue.runtime.js',
'@': path.resolve(__dirname, 'src')
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
include: path.resolve(__dirname, 'src')
},
{
test: /\.js$/,
loader: 'babel-loader',
include: path.resolve(__dirname, 'src')
},
{
test: /\.(sc|c)ss$/,
use: [
{
loader:MiniCSSExtractPlugin.loader,
options: {
hmr: true //process.env.NODE_ENV === 'development',
}
},
// {
// loader: 'file-loader',
// options: {
// name: 'css/[name].css',
// }
// },
{
loader: 'css-loader'
},
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')]
}
},
{
loader: 'resolve-url-loader',
},
{
loader: 'sass-loader'
}
]
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/',
publicPath: url => '../fonts/' + url
}
},
]
}
]
}
};